Add more authguard debug loggin'
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Peter (extern) 2023-03-06 10:29:43 +01:00
parent 60bc4c1a10
commit 945c641503

View File

@ -22,22 +22,26 @@ export class AuthGuard implements CanActivate, CanLoad, CanActivateChild {
constructor(private oauthService: OAuthService, private router: Router, private store: Store<appCommonReducer.State> ) { }
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> {
console.debug("AuthGuard->canActivate", route, state);
let url: string = state.url;
return this.checkLogin(url, route);
}
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> {
console.debug("AuthGuard->canActivateChild", childRoute, state);
let url: string = state.url;
return this.checkLogin(url, childRoute);
}
canLoad(route: Route): Promise<boolean> {
console.debug("AuthGuard->canLoad", route);
return this.checkLogin(route.path, null);
}
checkLogin(url: string, route: ActivatedRouteSnapshot): Promise<boolean> {
console.debug("AuthGuard->checkLogin", url, route);
return new Promise<boolean>((resolve) => {
if (!this.oauthService.hasValidAccessToken()) {
console.debug("No valid token");