This commit is contained in:
Taric Xin
2022-01-24 14:33:53 +08:00
parent e72b3727af
commit 6b92227e4a
6 changed files with 18 additions and 100 deletions

View File

@ -18,20 +18,23 @@ import { BaseService, EAUserService } from '@shared';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
const auths = ['YUNLI-CART-SEARCH', 'YUNLI-CART-DAOC1HU', 'YUNLI-CART-DETAIL','YUNLI-CART-AUDIT-SEARCH'];
const auths = ['YUNLI-CART-SEARCH', 'YUNLI-CART-DAOC1HU', 'YUNLI-CART-DETAIL', 'YUNLI-CART-AUDIT-SEARCH'];
@Injectable()
export class AuthGuard implements CanActivate, CanActivateChild, CanLoad {
constructor(private srv: ACLService, router: Router, private baseService: BaseService, private menuService: MenuService) {}
canLoad(route: Route, segments: UrlSegment[]): boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree> {
console.log(route);
return true;
}
canActivate(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot | null): Observable<boolean> {
console.log(route);
return this.handle();
}
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
console.log(childRoute);
return this.handle();
}