RED-5700 - logout error on session expired

This commit is contained in:
Timo Bejan 2023-01-10 14:16:46 +08:00
parent 4a8402f7eb
commit b20d4e938c

View File

@ -59,7 +59,16 @@ export abstract class IqserUserService<
async logout() {
await this._cacheApiService.wipeCaches();
await this._keycloakService.logout();
if(await this._keycloakService.isLoggedIn()) {
await this._keycloakService.logout();
}
window.location.href = this._keycloakService.getKeycloakInstance().createLoginUrl({
redirectUri: window.location.origin + this._baseHref,
});
}
async redirectToLogin(){
await this._cacheApiService.wipeCaches();
window.location.href = this._keycloakService.getKeycloakInstance().createLoginUrl({
redirectUri: window.location.origin + this._baseHref,
});
@ -80,8 +89,8 @@ export abstract class IqserUserService<
throw new Error('No user id');
}
} catch (e) {
console.log(e);
await this.logout();
console.log("Load KC profile failed");
await this.redirectToLogin();
return;
}