Add some debug logging
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
parent
b70ec77328
commit
1c8db3ac94
@ -40,19 +40,24 @@ export class AuthGuard implements CanActivate, CanLoad, CanActivateChild {
|
||||
checkLogin(url: string): Promise<boolean> {
|
||||
return new Promise<boolean>((resolve) => {
|
||||
if (!this.oauthService.hasValidAccessToken()) {
|
||||
console.debug("No valid token");
|
||||
if(this.oauthService.getRefreshToken() != null ) {
|
||||
console.debug("We have a refresh token");
|
||||
this.oauthService.refreshToken().then(() => {
|
||||
this.store.dispatch(new appCommonActions.InitUser());
|
||||
resolve(true);
|
||||
}).catch(() => {
|
||||
resolve(false);
|
||||
console.debug("Error refreshing");
|
||||
this.oauthService.initCodeFlow(url);
|
||||
resolve(false);
|
||||
})
|
||||
} else {
|
||||
resolve(false);
|
||||
console.debug("No refresh token");
|
||||
this.oauthService.initCodeFlow(url);
|
||||
resolve(false);
|
||||
}
|
||||
} else {
|
||||
console.debug("Valid token init user");
|
||||
this.store.dispatch(new appCommonActions.InitUser());
|
||||
return(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user