40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { Component, inject, OnInit, signal } from '@angular/core';
|
|
import { RouterOutlet, RouterLinkWithHref, Router, NavigationEnd } from '@angular/router';
|
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
|
import {
|
|
NgbNav,
|
|
NgbNavItem,
|
|
NgbNavItemRole,
|
|
NgbNavLinkBase,
|
|
} from '@ng-bootstrap/ng-bootstrap/nav';
|
|
import { filter } from 'rxjs';
|
|
import { APIService } from './services/api';
|
|
import { ToastContainer } from "./components/toast-container/toast-container";
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
imports: [RouterOutlet, NgbModule, NgbNav, NgbNavItem, NgbNavItemRole, NgbNavLinkBase, RouterLinkWithHref, ToastContainer],
|
|
templateUrl: './app.html',
|
|
styleUrl: './app.less'
|
|
})
|
|
export class App implements OnInit{
|
|
protected readonly title = signal('client');
|
|
protected api = inject(APIService);
|
|
active = '/';
|
|
|
|
constructor(
|
|
private router: Router
|
|
){}
|
|
|
|
ngOnInit(): void {
|
|
this.api.checkAuthStatus().subscribe();
|
|
this.router.events
|
|
.pipe(filter(event => event instanceof NavigationEnd))
|
|
.subscribe(() =>{
|
|
this.active = this.router.url;
|
|
console.log(this.active);
|
|
});
|
|
}
|
|
|
|
}
|