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 {
|
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 {
|
ngOnInit(): void {
|
||||||
|
|
||||||
|
@ -19,6 +23,7 @@ export class FavorisUserComponent implements OnInit {
|
||||||
console.log(this.personneConnectee);
|
console.log(this.personneConnectee);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,4 +68,6 @@ export class ApiBackService {
|
||||||
return this.httpClient.get<any[]>(`${environment.apiUrl}/user/${id}`);
|
return this.httpClient.get<any[]>(`${environment.apiUrl}/user/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class TokenService {
|
||||||
const token = this.getToken();
|
const token = this.getToken();
|
||||||
if(token) {
|
if(token) {
|
||||||
const decodedToken = jwt_decode<any>(token);
|
const decodedToken = jwt_decode<any>(token);
|
||||||
const userId = decodedToken.sub;
|
const userId = decodedToken.userId;
|
||||||
console.log(userId);
|
console.log(userId);
|
||||||
|
|
||||||
return userId;
|
return userId;
|
||||||
|
|
Loading…
Reference in New Issue