From 9bcf6d9b855e78e274d13fc2f121e2e51259ce21 Mon Sep 17 00:00:00 2001 From: Sonja Galovic Date: Wed, 23 Mar 2022 18:00:34 +0100 Subject: Profile page - izmena profila uskladjena sa back-om. --- frontend/src/app/_services/user-info.service.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'frontend/src/app/_services/user-info.service.ts') diff --git a/frontend/src/app/_services/user-info.service.ts b/frontend/src/app/_services/user-info.service.ts index b66a73e1..7ed2970c 100644 --- a/frontend/src/app/_services/user-info.service.ts +++ b/frontend/src/app/_services/user-info.service.ts @@ -12,15 +12,19 @@ export class UserInfoService { constructor(private http: HttpClient, private authService: AuthService) { } - getUsersInfo(): Observable { + getUserInfo(): Observable { return this.http.get(`${API_SETTINGS.apiURL}/user/myprofile`, { headers: this.authService.authHeader() }); } changeUserInfo(user: User): any { - return this.http.put(`${API_SETTINGS.apiURL}/user/${user._id}`, user, { headers: this.authService.authHeader() }); + return this.http.put(`${API_SETTINGS.apiURL}/user/changeinfo`, user, { headers: this.authService.authHeader() }); } - changeUserPassword(oldPassword: string, newPassword: string): Observable { - return this.http.put(`${API_SETTINGS.apiURL}/user/`, { oldPassword, newPassword }, { headers: this.authService.authHeader() }); + changeUserPassword(passwordArray: string[]): any { + return this.http.put(`${API_SETTINGS.apiURL}/user/changepass`, passwordArray, { headers: this.authService.authHeader(), responseType: 'text' }); + } + + deleteUser(): any { + return this.http.delete(`${API_SETTINGS.apiURL}/user/deleteprofile`, { headers: this.authService.authHeader() }); } } -- cgit v1.2.3