From 36b79bfb665fcf4e42a887b83d0cddb2d12ca297 Mon Sep 17 00:00:00 2001 From: Romain Verger Date: Wed, 2 Mar 2022 16:16:10 +0100 Subject: [PATCH] recuperer id du token --- src/app/pages/favoris-user/favoris-user.component.ts | 9 +++++++-- src/app/services/api-back.service.ts | 2 ++ src/app/services/token.service.ts | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/pages/favoris-user/favoris-user.component.ts b/src/app/pages/favoris-user/favoris-user.component.ts index d389b1f..862547a 100644 --- a/src/app/pages/favoris-user/favoris-user.component.ts +++ b/src/app/pages/favoris-user/favoris-user.component.ts @@ -9,9 +9,13 @@ import { TokenService } from 'src/app/services/token.service'; }) export class FavorisUserComponent implements OnInit { - personneConnectee : any; - constructor(private apiBackService : ApiBackService,private tokenService : TokenService) { } + personneConnectee : any; + listRestoFav: any; + + constructor(private apiBackService : ApiBackService,private tokenService : TokenService) { + + } ngOnInit(): void { @@ -19,6 +23,7 @@ export class FavorisUserComponent implements OnInit { console.log(this.personneConnectee); + } } diff --git a/src/app/services/api-back.service.ts b/src/app/services/api-back.service.ts index fe92400..2ceca0b 100644 --- a/src/app/services/api-back.service.ts +++ b/src/app/services/api-back.service.ts @@ -68,4 +68,6 @@ export class ApiBackService { return this.httpClient.get(`${environment.apiUrl}/user/${id}`); } + + } diff --git a/src/app/services/token.service.ts b/src/app/services/token.service.ts index 975f2e1..0529b5d 100644 --- a/src/app/services/token.service.ts +++ b/src/app/services/token.service.ts @@ -23,7 +23,7 @@ export class TokenService { const token = this.getToken(); if(token) { const decodedToken = jwt_decode(token); - const userId = decodedToken.sub; + const userId = decodedToken.userId; console.log(userId); return userId;