Compare commits

...
This repository has been archived on 2025-02-19. You can view files and clone it, but cannot push or open issues or pull requests.

2 commits

Author SHA1 Message Date
Phan Huy Tran
fe4116d4c2 style: format code with prettier 2025-02-12 11:39:45 +01:00
Phan Huy Tran
56fcb75599 Add login successful alert 2025-02-12 11:39:45 +01:00

View file

@ -9,12 +9,21 @@ import { routes } from './app.routes';
import {
KeycloakAngularModule,
KeycloakBearerInterceptor,
KeycloakEventType,
KeycloakService,
} from 'keycloak-angular';
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
export const initializeKeycloak = (keycloak: KeycloakService) => async () =>
keycloak.init({
export const initializeKeycloak = (keycloak: KeycloakService) => async () => {
keycloak.keycloakEvents$.subscribe({
next: (e: any) => {
if (e.type === KeycloakEventType.OnAuthSuccess) {
alert('Login erfolreich');
}
},
});
return await keycloak.init({
config: {
url: 'http://localhost:9090',
realm: 'LF12',
@ -28,6 +37,7 @@ export const initializeKeycloak = (keycloak: KeycloakService) => async () =>
redirectUri: 'http://localhost:4200',
},
});
};
function initializeApp(keycloak: KeycloakService): () => Promise<boolean> {
return () => initializeKeycloak(keycloak)();