module deconnexion
This commit is contained in:
parent
30f70296ba
commit
547f6aee58
@ -1,4 +1,4 @@
|
|||||||
<app-search-bar *ngIf="dontShow"></app-search-bar>
|
<app-search-bar></app-search-bar>
|
||||||
<app-nav-bar *ngIf="dontShow"></app-nav-bar>
|
<app-nav-bar></app-nav-bar>
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
<app-footer *ngIf="dontShow"></app-footer>
|
<app-footer ></app-footer>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<footer class="d-flex">
|
<footer *ngIf="route.url != '/signin'" class="d-flex">
|
||||||
|
|
||||||
<div class = "logo d-inline-flex align-items-center">
|
<div class = "logo d-inline-flex align-items-center">
|
||||||
<img src="../../assets/Logo_footer.png">
|
<img src="../../assets/Logo_footer.png">
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-footer',
|
selector: 'app-footer',
|
||||||
@ -7,7 +8,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class FooterComponent implements OnInit {
|
export class FooterComponent implements OnInit {
|
||||||
|
|
||||||
constructor() { }
|
constructor(public route : Router) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<nav class="navbar-expand-lg navbar-light">
|
<nav class="navbar-expand-lg navbar-light">
|
||||||
<div class="container-fluid">
|
<div *ngIf="route.url != '/signin'" class="container-fluid">
|
||||||
<button class="navbar-toggler"
|
<button class="navbar-toggler"
|
||||||
type="button"
|
type="button"
|
||||||
data-bs-toggle="collapse"
|
data-bs-toggle="collapse"
|
||||||
@ -10,16 +10,16 @@
|
|||||||
<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="nav">
|
||||||
<div class="navbar-nav ">
|
<div *ngIf="route.url != '/signin'" class="navbar-nav ">
|
||||||
<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="filtres" routerLinkActive="active-custom" class="nav-link p-4 pe-5" style="font-size: 21px;">Filtres</a>
|
<a routerLink="filtres" routerLinkActive="active-custom" class="nav-link p-4 pe-5" style="font-size: 21px;">Filtres</a>
|
||||||
<a routerLink="favoris" routerLinkActive="active-custom" class="nav-link p-4 pe-5" style="font-size: 21px;">Mes favoris</a>
|
<a routerLink="favoris" routerLinkActive="active-custom" class="nav-link p-4 pe-5" style="font-size: 21px;">Mes favoris</a>
|
||||||
<a routerLink="deconnexion" routerLinkActive="active-custom" class="nav-link p-4 pe-5" style="font-size: 21px;">Deconnexion</a>
|
<a routerLink="deconnexion" routerLinkActive="active-custom" (click) = "onCloseSession()" class="nav-link p-4 pe-5" style="font-size: 21px;">Deconnexion</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="image-header">
|
<div *ngIf="route.url != '/signin'" 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>
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { TokenService } from 'src/app/services/token.service';
|
||||||
|
import { environment } from 'src/environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-nav-bar',
|
selector: 'app-nav-bar',
|
||||||
@ -6,10 +9,17 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
styleUrls: ['./nav-bar.component.scss']
|
styleUrls: ['./nav-bar.component.scss']
|
||||||
})
|
})
|
||||||
export class NavBarComponent implements OnInit {
|
export class NavBarComponent implements OnInit {
|
||||||
|
tokenKey = environment.tokenKey;
|
||||||
|
|
||||||
constructor() { }
|
constructor( private tokenService : TokenService, public route: Router) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onCloseSession() : void {
|
||||||
|
this.tokenService.destroyToken();
|
||||||
|
this.route.navigate(['signin']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<nav class="navbar navbar-light p-0">
|
<nav class="navbar navbar-light p-0">
|
||||||
<div class="container-fluid d-flex align-items-center pt-3">
|
<div *ngIf="route.url != '/signin'" class="container-fluid d-flex align-items-center pt-3">
|
||||||
<div class="logo ps-4">
|
<div *ngIf="route.url != '/signin'" class="logo ps-4">
|
||||||
<img src="assets/images-header/LOGO2.png" alt="logo">
|
<img src="assets/images-header/LOGO2.png" alt="logo">
|
||||||
</div>
|
</div>
|
||||||
<form style="width: 30%;" class="d-flex align-items-center pe-2 pt-2">
|
<form style="width: 30%;" class="d-flex align-items-center pe-2 pt-2">
|
||||||
|
@ -13,7 +13,7 @@ export class SearchBarComponent implements OnInit {
|
|||||||
listRestau: any[];
|
listRestau: any[];
|
||||||
restauByName: any[];
|
restauByName: any[];
|
||||||
|
|
||||||
constructor(private apiBackService: ApiBackService, private route: Router) {
|
constructor(private apiBackService: ApiBackService, public route: Router) {
|
||||||
|
|
||||||
this.listRestau = [];
|
this.listRestau = [];
|
||||||
this.restauByName = [];
|
this.restauByName = [];
|
||||||
@ -36,6 +36,8 @@ export class SearchBarComponent implements OnInit {
|
|||||||
|
|
||||||
this.apiBackService.setListRestau(this.restauByName, "filtres");
|
this.apiBackService.setListRestau(this.restauByName, "filtres");
|
||||||
this.route.navigate(['restaurants']);
|
this.route.navigate(['restaurants']);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,4 +29,9 @@ export class TokenService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public destroyToken(): void {
|
||||||
|
localStorage.removeItem(this.tokenKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user