Chore: Auth Guard converted to CanActivateFn
This commit is contained in:
1 parent
a095ede3de
commit
b6bb3dbcfd
43 files changed
+231
-398
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule, inject } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, RouterModule, RouterStateSnapshot, Routes } from '@angular/router';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { AuthGuard } from '../auth/auth-guard.service';
|
||||
import { authGuard } from '../auth/auth-guard.service';
|
||||
|
||||
import { ClientDetailComponent } from './client-detail/client-detail.component';
|
||||
import { ClientListComponent } from './client-list/client-list.component';
|
||||
@@ -13,9 +13,7 @@ const clientRoutes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ClientListComponent,
|
||||
canActivate: [
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state),
|
||||
],
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
permission: 'Cost Centres',
|
||||
},
|
||||
@@ -26,9 +24,7 @@ const clientRoutes: Routes = [
|
||||
{
|
||||
path: ':id',
|
||||
component: ClientDetailComponent,
|
||||
canActivate: [
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state),
|
||||
],
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
permission: 'Cost Centres',
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user