Files
SkydiveLogs/Front/skydivelogs-app/src/app/app.component.ts
Sébastien André 8abeec6664 Ajout du numéro de version +
changement de l'URL de l'API pour
la Prod
2020-04-04 15:58:12 +02:00

49 lines
1.2 KiB
TypeScript

import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { User } from "../models/user";
import { environment } from "../environments/environment";
import { AuthenticationService } from "../services/authentication.service";
import { ServiceComm } from "../services/service-comm.service";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"]
})
export class AppComponent implements OnInit {
public title = "app";
public showMenu = false;
public currentUser: User;
public version: string = environment.version;
constructor(
private router: Router,
private authenticationService: AuthenticationService,
private serviceComm: ServiceComm
) {
this.authenticationService.currentUser.subscribe(
x => (this.currentUser = x)
);
}
ngOnInit() {
this.serviceComm.componentTitle.subscribe(title => (this.title = title));
}
toggleMenu() {
this.showMenu = !this.showMenu;
}
show() {
return this.authenticationService.currentUserValue != undefined;
}
logout() {
this.authenticationService.logout();
this.showMenu = !this.showMenu;
this.router.navigate(["/login"], { skipLocationChange: true });
}
}