init : getPersonne dans favoris
This commit is contained in:
parent
829c8333f6
commit
b3987b0255
@ -11,11 +11,19 @@ export class FavorisUserComponent implements OnInit {
|
||||
|
||||
personneConnectee : any;
|
||||
|
||||
constructor(private apiBackService : ApiBackService,private tokenService : TokenService) { }
|
||||
constructor(private apiBackService : ApiBackService,private tokenService : TokenService) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.personneConnectee = this.apiBackService.getPersonneById(this.tokenService.getCurrentUserId());
|
||||
|
||||
this.apiBackService.getPersonneById(this.tokenService.getCurrentUserId()).subscribe(
|
||||
resp =>{
|
||||
console.log(resp);
|
||||
|
||||
this.personneConnectee = resp;
|
||||
}
|
||||
);
|
||||
console.log(this.personneConnectee);
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@ export class ApiBackService {
|
||||
|
||||
}
|
||||
|
||||
getPersonneById(id: number | null) {
|
||||
getPersonneById(id: any) {
|
||||
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