sidebar behaviour done

This commit is contained in:
rubikscraft
2022-03-18 20:52:03 +01:00
parent fc060cad69
commit c26e1aef38
2 changed files with 8 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import { Component, Inject, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { PRoutes } from 'src/app/models/picsur-routes';
import { PermissionService } from 'src/app/services/api/permission.service';
@@ -14,7 +15,8 @@ export class SettingsSidebarComponent implements OnInit {
constructor(
@Inject('SettingsRoutes') private settingsRoutes: PRoutes,
private permissionService: PermissionService
private permissionService: PermissionService,
private router: Router
) {}
ngOnInit() {
@@ -40,6 +42,10 @@ export class SettingsSidebarComponent implements OnInit {
this.systemRoutes = this.accessibleRoutes.filter(
(route) => route.data?.page?.category === 'system'
);
if (this.systemRoutes.length === 0 && this.personalRoutes.length === 0) {
this.router.navigate(['/']);
}
});
}
}

View File

@@ -29,7 +29,7 @@ const SettingsRoutes: PRoutes = [
},
},
{
path: 'general',
path: 'syspref',
loadChildren: () => SettingsSysprefRouteModule,
data: {
permissions: [Permission.SysPrefManage],