27.4.3. Modified Frontend UserService to call PUT request to new endpoint URL (#27)

This commit is contained in:
Art
2021-09-28 17:25:39 +03:00
parent da6d786574
commit 9a3aa8b84c
2 changed files with 3 additions and 3 deletions

View File

@ -247,7 +247,7 @@ export class UserComponent implements OnInit, OnDestroy {
const formData = new FormData();
formData.append("profileImage", this.profileImage);
let user = this.authenticationService.getUserFromLocalStorage();
this.subs.sink = this.userService.updateProfileImage(user.username, formData)
this.subs.sink = this.userService.updateProfileImage(user.userId, formData)
.subscribe(
(event: HttpEvent<any>) => {
this.reportUploadProgress(event);

View File

@ -36,9 +36,9 @@ export class UserService {
.post<CustomHttpResponse>(`${this.host}/user/resetPassword/${email}`, null);
}
public updateProfileImage(username: string, formData: FormData): Observable<HttpEvent<User>> {
public updateProfileImage(userId: string, formData: FormData): Observable<HttpEvent<User>> {
return this.httpClient
.put<User>(`${this.host}/user/${username}/profileImage`, formData,
.put<User>(`${this.host}/user/${userId}/profile-image`, formData,
{
reportProgress: true,
observe: 'events'