More migration fixes

This commit is contained in:
Willem Dantuma
2020-04-01 16:11:44 +02:00
parent 511f1f4731
commit 80ddf816b0
10 changed files with 43 additions and 59 deletions

View File

@@ -38,24 +38,19 @@ export class AuthGuard implements CanActivate, CanLoad, CanActivateChild {
checkLogin(url: string): boolean {
if (!this.oauthService.hasValidAccessToken()) {
this.oauthService.responseType
if(this.oauthService.responseType == "code")
if(this.oauthService.getRefreshToken() != null ) {
this.oauthService.refreshToken().then(() => {
this.store.dispatch(new appCommonActions.InitUser());
return true;
}).catch(() => {
this.oauthService.initCodeFlow(url);
return false;
}
)
} else {
if(this.oauthService.getRefreshToken() != null ) {
this.oauthService.refreshToken().then(() => {
this.store.dispatch(new appCommonActions.InitUser());
return true;
}).catch(() => {
this.oauthService.initCodeFlow(url);
return false;
}
else
this.oauthService.initImplicitFlow(url);
}
)
} else {
this.oauthService.initCodeFlow(url);
return false;
}
} else {
this.store.dispatch(new appCommonActions.InitUser());
return true;