blob: a0ad4817562bdbfa9e6d5f1be5964576eb8a593e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { Injectable } from '@angular/core'
import {
ActivatedRouteSnapshot,
CanActivateChild,
RouterStateSnapshot,
CanActivate
} from '@angular/router'
import { AuthService } from '../core'
@Injectable()
export class AdminGuard implements CanActivate, CanActivateChild {
constructor (private auth: AuthService) {}
canActivate (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
return this.auth.isAdmin()
}
canActivateChild (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
return this.canActivate(route, state)
}
}
|