This commit is contained in:
Romain Verger 2022-03-04 15:18:44 +01:00
parent ffc40296f3
commit 0f68db5042
7 changed files with 15 additions and 17 deletions

View File

@ -15,9 +15,7 @@ export class UpdateDelRestauComponent implements OnInit {
this.restauList = []; this.restauList = [];
} }
ngOnInit(): void { ngOnInit(): void {}
}
saveRestauList(event : any){ saveRestauList(event : any){
@ -28,10 +26,7 @@ export class UpdateDelRestauComponent implements OnInit {
deleteRestau(idRestau : number | undefined){ deleteRestau(idRestau : number | undefined){
this.apiBackService.deleteRestau(idRestau).subscribe( this.apiBackService.deleteRestau(idRestau).subscribe(
resp =>{ resp =>{
this.restauList = this.restauList.filter(restaus => restaus.id != idRestau) this.restauList = this.restauList.filter(restaus => restaus.id != idRestau)
}); });
} }

View File

@ -9,8 +9,8 @@
aria-label="Toggle navigation"> aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse justify-content-end" id="nav"> <div class="collapse navbar-collapse justify-content-end" id="navbarNavAltMarkup">
<div class="navbar-nav "> <div class="navbar-nav navbar-light">
<a routerLink="home" routerLinkActive="active-custom" class="nav-link p-4 pe-5 " style="font-size: 21px;">Accueil</a> <a routerLink="home" routerLinkActive="active-custom" class="nav-link p-4 pe-5 " style="font-size: 21px;">Accueil</a>
<a routerLink="categories" routerLinkActive="active-custom" class="nav-link p-4 pe-5" style="font-size: 21px;">Categories</a> <a routerLink="categories" routerLinkActive="active-custom" class="nav-link p-4 pe-5" style="font-size: 21px;">Categories</a>
<a routerLink="restaurants" routerLinkActive="active-custom" class="nav-link p-4 pe-5" style="font-size: 21px;">Restaurants</a> <a routerLink="restaurants" routerLinkActive="active-custom" class="nav-link p-4 pe-5" style="font-size: 21px;">Restaurants</a>
@ -23,7 +23,6 @@
<div id="image-header"> <div id="image-header">
<img src="assets/images-header/bandeau2.png" alt="fond_header"> <img src="assets/images-header/bandeau2.png" alt="fond_header">
</div> </div>
</nav> </nav>

View File

@ -9,15 +9,21 @@ import { environment } from 'src/environments/environment';
styleUrls: ['./nav-bar.component.scss'] styleUrls: ['./nav-bar.component.scss']
}) })
export class NavBarComponent implements OnInit { export class NavBarComponent implements OnInit {
tokenKey = environment.tokenKey;
constructor( private tokenService : TokenService, public route: Router) { } private tokenKey: string;
constructor( private tokenService : TokenService, public route: Router) {
this.tokenKey = environment.tokenKey;
}
ngOnInit(): void { ngOnInit(): void {
} }
onCloseSession() : void { onCloseSession() : void {
this.tokenService.destroyToken();
this.tokenService.destroyToken(this.tokenKey);
this.route.navigate(['signin']); this.route.navigate(['signin']);
} }

View File

@ -1,7 +1,7 @@
export interface User { export interface User {
id?:number; id?:number;
prenom: string; prenom: string;
lastName: string; nom: string;
email: string; email: string;
password?: string; password?: string;
preference ?: object; preference ?: object;

View File

@ -1,7 +1,6 @@
<div class="signin-form text-center"> <div class="signin-form text-center">
<main class="form-signin d-inline-flex"> <main class="form-signin d-inline-flex">
<form (ngSubmit)="onSubmit(signinForm)" #signinForm="ngForm"> <form (ngSubmit)="onSubmit(signinForm)" #signinForm="ngForm">
<h5>Merci de vous connecter</h5>
<img src="../../../assets/images-header/logo.png"><br> <img src="../../../assets/images-header/logo.png"><br>
<br>Le bon plan pour manger<br> <br>Le bon plan pour manger<br>
<div class="form-floating"> <div class="form-floating">

View File

@ -31,7 +31,6 @@ export class AuthGuard implements CanActivate {
const dateExp = new Date(decodedToken.exp * 1000); const dateExp = new Date(decodedToken.exp * 1000);
if(new Date() >= dateExp) { if(new Date() >= dateExp) {
// le token a expiré, je n'autorise pas l'accès // le token a expiré, je n'autorise pas l'accès
this.tokenService.destroyToken();
this.router.navigate(['signin']); this.router.navigate(['signin']);
return false; return false;
} }

View File

@ -33,7 +33,7 @@ export class TokenService {
} }
public destroyToken(): void { public destroyToken(token : any) {
localStorage.removeItem(this.tokenKey); localStorage.removeItem(token);
} }
} }