wip
This commit is contained in:
parent
32aa753452
commit
33683f565f
11 changed files with 330 additions and 294 deletions
|
@ -1,9 +1,9 @@
|
|||
import { ChangeDetectionStrategy, Component, inject, OnInit, signal } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import { UserService } from '../../../service/user.service';
|
||||
|
||||
import { CurrencyPipe } from '@angular/common';
|
||||
import { AuthService } from '../../../service/auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-navbar',
|
||||
templateUrl: './navbar.component.html',
|
||||
|
@ -13,8 +13,8 @@ import { CurrencyPipe } from '@angular/common';
|
|||
})
|
||||
export class NavbarComponent implements OnInit {
|
||||
isMenuOpen = false;
|
||||
private keycloakService: KeycloakService = inject(KeycloakService);
|
||||
isLoggedIn = this.keycloakService.isLoggedIn();
|
||||
private authService: AuthService = inject(AuthService);
|
||||
isLoggedIn = this.authService.isLoggedIn();
|
||||
|
||||
private userService = inject(UserService);
|
||||
private user = this.userService.getCurrentUser();
|
||||
|
@ -29,15 +29,14 @@ export class NavbarComponent implements OnInit {
|
|||
|
||||
login() {
|
||||
try {
|
||||
const baseUrl = window.location.origin;
|
||||
this.keycloakService.login({ redirectUri: `${baseUrl}/login/success` });
|
||||
this.authService.login();
|
||||
} catch (error) {
|
||||
console.error('Login failed:', error);
|
||||
}
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.keycloakService.logout();
|
||||
this.authService.logout();
|
||||
}
|
||||
|
||||
toggleMenu() {
|
||||
|
|
Reference in a new issue