Refactor token refresh flows
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma
2020-10-30 08:22:58 +01:00
parent 46c5f74b49
commit 2656a67fca
4 changed files with 28 additions and 32 deletions

View File

@@ -137,7 +137,17 @@ export class AppComponent implements OnInit, OnDestroy {
this.router.navigate(['loggedout'], { queryParams: { redirectTo: this.router.url } });
}
}
if(event.type == 'token_received') {
this.store$.dispatch(new commonActions.InitUser());
}
});
if(this.oauthService$.hasValidAccessToken) {
this.store$.dispatch(new commonActions.InitUser());
} else {
if(this.oauthService$.getRefreshToken() !=null) {
this.oauthService$.refreshToken();
}
}
}
private InstallRouteEventHandler() {