feat: Add success alert after login (CAS-1) #19

Closed
ptran wants to merge 2 commits from feat/success-alert into main
Showing only changes of commit fe4116d4c2 - Show all commits

View File

@ -3,15 +3,16 @@ import {
ApplicationConfig,
provideExperimentalZonelessChangeDetection,
} from '@angular/core';
import {provideRouter} from '@angular/router';
import { provideRouter } from '@angular/router';
import {routes} from './app.routes';
import { routes } from './app.routes';
import {
KeycloakAngularModule,
KeycloakBearerInterceptor, KeycloakEventType,
KeycloakBearerInterceptor,
KeycloakEventType,
KeycloakService,
} from 'keycloak-angular';
import {HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi} from '@angular/common/http';
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
export const initializeKeycloak = (keycloak: KeycloakService) => async () => {
keycloak.keycloakEvents$.subscribe({
@ -19,7 +20,7 @@ export const initializeKeycloak = (keycloak: KeycloakService) => async () => {
if (e.type === KeycloakEventType.OnAuthSuccess) {
alert('Login erfolreich');
}
}
},
});
return await keycloak.init({
@ -36,7 +37,7 @@ export const initializeKeycloak = (keycloak: KeycloakService) => async () => {
redirectUri: 'http://localhost:4200',
},
});
}
};
function initializeApp(keycloak: KeycloakService): () => Promise<boolean> {
return () => initializeKeycloak(keycloak)();