recuperer id du token

This commit is contained in:
Romain Verger 2022-03-02 16:16:10 +01:00
parent 0478637dd6
commit 36b79bfb66
3 changed files with 10 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -68,4 +68,6 @@ export class ApiBackService {
return this.httpClient.get<any[]>(`${environment.apiUrl}/user/${id}`);
}
}

View File

@ -23,7 +23,7 @@ export class TokenService {
const token = this.getToken();
if(token) {
const decodedToken = jwt_decode<any>(token);
const userId = decodedToken.sub;
const userId = decodedToken.userId;
console.log(userId);
return userId;