update user & auth
This commit is contained in:
parent
34b7ebcef7
commit
3906421aa0
@ -35,8 +35,8 @@ function getKeycloakOptions(baseUrl: string, configService: BaseConfigService):
|
||||
}
|
||||
|
||||
function configureAutomaticRedirectToLoginScreen(keyCloakService: KeycloakService) {
|
||||
keyCloakService.getKeycloakInstance().onAuthRefreshError = () => {
|
||||
void keyCloakService.logout().then();
|
||||
keyCloakService.getKeycloakInstance().onAuthRefreshError = async () => {
|
||||
await keyCloakService.logout();
|
||||
};
|
||||
}
|
||||
|
||||
@ -53,7 +53,6 @@ export function keycloakInitializer(
|
||||
imports: [CommonModule, HttpClientModule, KeycloakAngularModule],
|
||||
providers: [
|
||||
AuthGuard,
|
||||
RoleGuard,
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: keycloakInitializer,
|
||||
|
||||
@ -49,9 +49,9 @@ export abstract class BaseUserService<
|
||||
await firstValueFrom(this.loadAll());
|
||||
}
|
||||
|
||||
logout() {
|
||||
void this._cacheApiService.wipeCaches().then();
|
||||
void this._keycloakService.logout(window.location.origin + this._baseHref).then();
|
||||
async logout() {
|
||||
await this._cacheApiService.wipeCaches();
|
||||
await this._keycloakService.logout(window.location.origin + this._baseHref);
|
||||
}
|
||||
|
||||
loadAll() {
|
||||
@ -71,8 +71,8 @@ export abstract class BaseUserService<
|
||||
try {
|
||||
profile = await this._keycloakService.loadUserProfile(true);
|
||||
} catch (e) {
|
||||
await this._keycloakService.logout();
|
||||
console.log(e);
|
||||
await this.logout();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user