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> {
|
checkLogin(url: string): Promise<boolean> {
|
||||||
return new Promise<boolean>((resolve) => {
|
return new Promise<boolean>((resolve) => {
|
||||||
if (!this.oauthService.hasValidAccessToken()) {
|
if (!this.oauthService.hasValidAccessToken()) {
|
||||||
|
console.debug("No valid token");
|
||||||
if(this.oauthService.getRefreshToken() != null ) {
|
if(this.oauthService.getRefreshToken() != null ) {
|
||||||
|
console.debug("We have a refresh token");
|
||||||
this.oauthService.refreshToken().then(() => {
|
this.oauthService.refreshToken().then(() => {
|
||||||
this.store.dispatch(new appCommonActions.InitUser());
|
this.store.dispatch(new appCommonActions.InitUser());
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
resolve(false);
|
console.debug("Error refreshing");
|
||||||
this.oauthService.initCodeFlow(url);
|
this.oauthService.initCodeFlow(url);
|
||||||
|
resolve(false);
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
resolve(false);
|
console.debug("No refresh token");
|
||||||
this.oauthService.initCodeFlow(url);
|
this.oauthService.initCodeFlow(url);
|
||||||
|
resolve(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
console.debug("Valid token init user");
|
||||||
this.store.dispatch(new appCommonActions.InitUser());
|
this.store.dispatch(new appCommonActions.InitUser());
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user