brewman/overlord/src/app/core/nav-bar/nav-bar.component.ts

34 lines
798 B
TypeScript

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { environment } from '../../../environments/environment';
import { AuthService } from '../../auth/auth.service';
import { TitleService } from '../title.service';
@Component({
selector: 'app-nav-bar',
templateUrl: './nav-bar.component.html',
styleUrls: ['./nav-bar.component.css'],
})
export class NavBarComponent implements OnInit {
title: string;
constructor(
private router: Router,
public auth: AuthService,
public titleService: TitleService,
) {
this.title = environment.title;
}
ngOnInit() {
this.titleService.get().subscribe((value) => {
this.title = value;
});
}
logout() {
this.auth.logout();
this.router.navigate(['/']);
}
}