recuperer id du token
This commit is contained in:
parent
0478637dd6
commit
36b79bfb66
@ -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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -68,4 +68,6 @@ export class ApiBackService {
|
||||
return this.httpClient.get<any[]>(`${environment.apiUrl}/user/${id}`);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user