Chore: Auth Guard converted to CanActivateFn
This commit is contained in:
@@ -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 { costCentreListResolver } from '../cost-centre/cost-centre-list.resolver';
|
||||
|
||||
import { AccountDetailComponent } from './account-detail/account-detail.component';
|
||||
@@ -15,9 +15,7 @@ const accountRoutes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: AccountListComponent,
|
||||
canActivate: [
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state),
|
||||
],
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
permission: 'Accounts',
|
||||
},
|
||||
@@ -29,9 +27,7 @@ const accountRoutes: Routes = [
|
||||
{
|
||||
path: 'new',
|
||||
component: AccountDetailComponent,
|
||||
canActivate: [
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state),
|
||||
],
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
permission: 'Accounts',
|
||||
},
|
||||
@@ -44,9 +40,7 @@ const accountRoutes: Routes = [
|
||||
{
|
||||
path: ':id',
|
||||
component: AccountDetailComponent,
|
||||
canActivate: [
|
||||
(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state),
|
||||
],
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
permission: 'Accounts',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user