Merge pull request 'feat: Add proper redirects to login and logout buttons (CAS-1)' (!17) from feature/login-logout-redirect into main
Reviewed-on: https://git.simonis.lol/projects/casino/pulls/17 Reviewed-by: Constantin Simonis <constantin@simonis.lol> Reviewed-by: jank1619 <jan@kjan.email>
This commit is contained in:
commit
6072e81299
3 changed files with 7 additions and 3 deletions
|
@ -12,5 +12,5 @@ export const routes: Routes = [
|
|||
path: 'home',
|
||||
component: HomepageComponent,
|
||||
canActivate: [authGuard],
|
||||
}
|
||||
},
|
||||
];
|
||||
|
|
|
@ -12,6 +12,8 @@ export class HomepageComponent {
|
|||
private keycloakService: KeycloakService = inject(KeycloakService);
|
||||
|
||||
logout() {
|
||||
this.keycloakService.logout();
|
||||
const baseUrl = window.location.origin;
|
||||
|
||||
this.keycloakService.logout(`${baseUrl}/`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ export class LandingPageComponent {
|
|||
private keycloakService: KeycloakService = inject(KeycloakService);
|
||||
|
||||
login() {
|
||||
this.keycloakService.login();
|
||||
const baseUrl = window.location.origin;
|
||||
|
||||
this.keycloakService.login({ redirectUri: `${baseUrl}/home` });
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue