Style du login
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ServiceComm } from '../services/service-comm.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { AuthenticationService } from '../services/authentication.service';
|
||||
import { User } from '../models/user';
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
import { User } from "../models/user";
|
||||
|
||||
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']
|
||||
selector: "app-root",
|
||||
templateUrl: "./app.component.html",
|
||||
styleUrls: ["./app.component.css"]
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
title = 'app';
|
||||
title = "app";
|
||||
showMenu = false;
|
||||
currentUser: User;
|
||||
|
||||
@@ -19,7 +21,9 @@ export class AppComponent implements OnInit {
|
||||
private authenticationService: AuthenticationService,
|
||||
private serviceComm: ServiceComm
|
||||
) {
|
||||
this.authenticationService.currentUser.subscribe(x => this.currentUser = x);
|
||||
this.authenticationService.currentUser.subscribe(
|
||||
x => (this.currentUser = x)
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -30,9 +34,13 @@ export class AppComponent implements OnInit {
|
||||
this.showMenu = !this.showMenu;
|
||||
}
|
||||
|
||||
show() {
|
||||
return this.authenticationService.currentUserValue != undefined;
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.authenticationService.logout();
|
||||
this.showMenu = !this.showMenu;
|
||||
this.router.navigate(['/login']);
|
||||
this.router.navigate(["/login"]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user