change over primeng v22
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import { AuthenticationService } from '../user-services';
|
||||
import { Subscription } from 'rxjs'
|
||||
import { Component, EventEmitter, Output, OnInit, OnDestroy, inject, signal } from '@angular/core';
|
||||
import { Router, RouterModule } from '@angular/router';
|
||||
import { Utils } from '../shares';
|
||||
import { AngleDown } from '@primeicons/angular/angle-down';
|
||||
import { SidebarModule } from 'primeng/sidebar';
|
||||
|
||||
@Component({
|
||||
selector: 'app-nav-toolbar',
|
||||
imports: [RouterModule, AngleDown, SidebarModule],
|
||||
templateUrl: './nav-toolbar.component.html',
|
||||
styleUrls: ['./nav-toolbar.component.css']
|
||||
})
|
||||
export class NavToolarComponent implements OnInit, OnDestroy {
|
||||
isExpanded = false;
|
||||
isAuth = signal(false);
|
||||
isAdmin = signal(false);
|
||||
currentUserName = "";
|
||||
authSubscription: Subscription = new Subscription;
|
||||
@Output() toggleEvent: EventEmitter<boolean> = new EventEmitter();
|
||||
private authService = inject(AuthenticationService);
|
||||
|
||||
constructor(
|
||||
private router: Router) { }
|
||||
|
||||
ngOnInit() {
|
||||
const currentUser = this.authService.authChange();
|
||||
this.isAuth.set(false);
|
||||
this.isAdmin.set(false);
|
||||
if (currentUser.firstName != '') {
|
||||
this.isAuth.set(Utils.getIsAuth());
|
||||
this.isAdmin.set(Utils.getIsAdmin());
|
||||
this.currentUserName = currentUser.firstName + ' ' + currentUser.lastName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.authSubscription) {
|
||||
this.authSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
onHome() {
|
||||
this.router.navigate(['/concessionvalidation']);
|
||||
}
|
||||
onToggle() {
|
||||
this.isExpanded = !this.isExpanded;
|
||||
this.toggleEvent.emit(this.isExpanded);
|
||||
}
|
||||
onLogout() {
|
||||
this.authService.logout();
|
||||
this.router.navigate(['/login']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user