trucs de menu et token
This commit is contained in:
parent
1d96834459
commit
476cc12cc0
@ -50,11 +50,12 @@ public upMenuForm : FormGroup;
|
|||||||
|
|
||||||
//delete d'un menu
|
//delete d'un menu
|
||||||
deleteMenu(id_menu : number): void {
|
deleteMenu(id_menu : number): void {
|
||||||
window.alert("Le menu a bien été supprimé!")
|
// window.alert("Le menu a bien été supprimé!")
|
||||||
this.menusService.deleteMenu(id_menu)?.subscribe((resp) => {
|
this.menusService.deleteMenu(id_menu)?.subscribe((resp) => {
|
||||||
// this.router.navigate(['menu']);
|
// this.router.navigate(['menu']);
|
||||||
|
window.location.reload();
|
||||||
});
|
});
|
||||||
window.location.reload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//updateMenu
|
//updateMenu
|
||||||
@ -76,8 +77,8 @@ updateMenu(id_menu : number): void {
|
|||||||
|
|
||||||
this.menusService.updateMenu(menu, id_menu)?.subscribe((resp) => {
|
this.menusService.updateMenu(menu, id_menu)?.subscribe((resp) => {
|
||||||
console.log(menu, id_menu);
|
console.log(menu, id_menu);
|
||||||
|
window.location.reload();
|
||||||
});
|
});
|
||||||
window.location.reload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,4 +14,5 @@
|
|||||||
</div>
|
</div>
|
||||||
<a class="navbar-brand" href="#">Organizee</a>
|
<a class="navbar-brand" href="#">Organizee</a>
|
||||||
</div>
|
</div>
|
||||||
|
<app-deconnexion *ngIf="isLogged"></app-deconnexion>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { TokenService } from 'src/app/services/token.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -7,12 +8,19 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
styleUrls: ['./header.component.scss']
|
styleUrls: ['./header.component.scss']
|
||||||
})
|
})
|
||||||
export class HeaderComponent implements OnInit {
|
export class HeaderComponent implements OnInit {
|
||||||
|
isLogged=false;
|
||||||
|
|
||||||
constructor(){
|
|
||||||
|
|
||||||
}
|
constructor(public tokenService : TokenService){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
|
if(this.tokenService.getToken()){
|
||||||
|
this.isLogged=true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
<app-deconnexion></app-deconnexion>
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar></app-side-bar>
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
<app-side-bar></app-side-bar>
|
<app-side-bar></app-side-bar>
|
||||||
|
|
||||||
|
|
||||||
<app-deconnexion></app-deconnexion>
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div>
|
<div>
|
||||||
<h3 class="titre">Bienvenue {{ conectedUser.prenom }}!!</h3>
|
<h3 class="titre">Bienvenue {{ conectedUser.prenom }}!!</h3>
|
||||||
|
@ -45,7 +45,7 @@ apiUrl: string;
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteMenu(id:number): Observable<any> {
|
deleteMenu(id:number): Observable<any> {
|
||||||
return this.http.delete(`${this.apiUrl}/menus/delete/${id}`);
|
return this.http.delete(`${this.apiUrl}/menus/delete/${id}`, {responseType:"text"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ tokenKey = environment.tokenKey;
|
|||||||
public eraseToken(): string | null {
|
public eraseToken(): string | null {
|
||||||
const token = localStorage.getItem(this.tokenKey);
|
const token = localStorage.getItem(this.tokenKey);
|
||||||
if(token) {
|
if(token) {
|
||||||
this.tokenKey = '';
|
localStorage.removeItem(this.tokenKey);
|
||||||
return token;
|
return token;
|
||||||
}else {
|
}else {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user