Implement healthcheck service
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:
@@ -165,18 +165,21 @@ export class AppCommonEffects {
|
||||
@Effect({ dispatch: false })
|
||||
online$: Observable<Action> = this.actions$.pipe(
|
||||
ofType(appCommonActions.ONLINE),
|
||||
map((action) => {
|
||||
console.debug("Online: Check token");
|
||||
if(!this.oauthService$.hasValidAccessToken()) {
|
||||
console.debug("No valid token, try to refresh");
|
||||
if(this.oauthService$.getRefreshToken() != null ) {
|
||||
console.debug("We have a refresh token");
|
||||
this.oauthService$.refreshToken().then(() => {
|
||||
this.store$.dispatch(new appCommonActions.InitUser());
|
||||
});
|
||||
}
|
||||
withLatestFrom(this.store$.select(appCommonReducers.SelectGetIsOnline)),
|
||||
switchMap(([action,isOnline]) => {
|
||||
if(!isOnline) {
|
||||
console.debug("Online: Check token");
|
||||
if(!this.oauthService$.hasValidAccessToken()) {
|
||||
console.debug("No valid token, try to refresh");
|
||||
if(this.oauthService$.getRefreshToken() != null ) {
|
||||
console.debug("We have a refresh token");
|
||||
this.oauthService$.refreshToken().then(() => {
|
||||
this.store$.dispatch(new appCommonActions.InitUser());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return of(undefined);
|
||||
}));
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user