mirror of
https://github.com/CaramelFur/Picsur.git
synced 2025-11-13 07:15:39 +01:00
sidebar behaviour done
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { Component, Inject, OnInit } from '@angular/core';
|
import { Component, Inject, OnInit } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
import { PRoutes } from 'src/app/models/picsur-routes';
|
import { PRoutes } from 'src/app/models/picsur-routes';
|
||||||
import { PermissionService } from 'src/app/services/api/permission.service';
|
import { PermissionService } from 'src/app/services/api/permission.service';
|
||||||
|
|
||||||
@@ -14,7 +15,8 @@ export class SettingsSidebarComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject('SettingsRoutes') private settingsRoutes: PRoutes,
|
@Inject('SettingsRoutes') private settingsRoutes: PRoutes,
|
||||||
private permissionService: PermissionService
|
private permissionService: PermissionService,
|
||||||
|
private router: Router
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -40,6 +42,10 @@ export class SettingsSidebarComponent implements OnInit {
|
|||||||
this.systemRoutes = this.accessibleRoutes.filter(
|
this.systemRoutes = this.accessibleRoutes.filter(
|
||||||
(route) => route.data?.page?.category === 'system'
|
(route) => route.data?.page?.category === 'system'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (this.systemRoutes.length === 0 && this.personalRoutes.length === 0) {
|
||||||
|
this.router.navigate(['/']);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const SettingsRoutes: PRoutes = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'general',
|
path: 'syspref',
|
||||||
loadChildren: () => SettingsSysprefRouteModule,
|
loadChildren: () => SettingsSysprefRouteModule,
|
||||||
data: {
|
data: {
|
||||||
permissions: [Permission.SysPrefManage],
|
permissions: [Permission.SysPrefManage],
|
||||||
|
|||||||
Reference in New Issue
Block a user