Merge branch 'Romain' into dev

This commit is contained in:
Romain Verger 2022-03-04 15:19:37 +01:00
commit f086d7b70d
7 changed files with 14 additions and 16 deletions

View File

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

View File

@ -10,7 +10,7 @@
<span class="navbar-toggler-icon"></span>
</button>
<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="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>
@ -23,7 +23,6 @@
<div id="image-header">
<img src="assets/images-header/bandeau2.png" alt="fond_header">
</div>
</nav>

View File

@ -9,15 +9,21 @@ import { environment } from 'src/environments/environment';
styleUrls: ['./nav-bar.component.scss']
})
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 {
}
onCloseSession() : void {
this.tokenService.destroyToken();
this.tokenService.destroyToken(this.tokenKey);
this.route.navigate(['signin']);
}

View File

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

View File

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

View File

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

View File

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