diff --git a/src/app/pages/favoris-user/favoris-user.component.ts b/src/app/pages/favoris-user/favoris-user.component.ts index d389b1f..84adea7 100644 --- a/src/app/pages/favoris-user/favoris-user.component.ts +++ b/src/app/pages/favoris-user/favoris-user.component.ts @@ -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); diff --git a/src/app/services/api-back.service.ts b/src/app/services/api-back.service.ts index 7fce209..091ff2b 100644 --- a/src/app/services/api-back.service.ts +++ b/src/app/services/api-back.service.ts @@ -70,7 +70,7 @@ export class ApiBackService { } - getPersonneById(id: number | null) { + getPersonneById(id: any) { return this.httpClient.get(`${environment.apiUrl}/user/${id}`); } } \ No newline at end of file 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;