27.4.3. Modified Frontend UserService to call PUT request to new endpoint URL (#27)
This commit is contained in:
@ -247,7 +247,7 @@ export class UserComponent implements OnInit, OnDestroy {
|
|||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("profileImage", this.profileImage);
|
formData.append("profileImage", this.profileImage);
|
||||||
let user = this.authenticationService.getUserFromLocalStorage();
|
let user = this.authenticationService.getUserFromLocalStorage();
|
||||||
this.subs.sink = this.userService.updateProfileImage(user.username, formData)
|
this.subs.sink = this.userService.updateProfileImage(user.userId, formData)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(event: HttpEvent<any>) => {
|
(event: HttpEvent<any>) => {
|
||||||
this.reportUploadProgress(event);
|
this.reportUploadProgress(event);
|
||||||
|
|||||||
@ -36,9 +36,9 @@ export class UserService {
|
|||||||
.post<CustomHttpResponse>(`${this.host}/user/resetPassword/${email}`, null);
|
.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
|
return this.httpClient
|
||||||
.put<User>(`${this.host}/user/${username}/profileImage`, formData,
|
.put<User>(`${this.host}/user/${userId}/profile-image`, formData,
|
||||||
{
|
{
|
||||||
reportProgress: true,
|
reportProgress: true,
|
||||||
observe: 'events'
|
observe: 'events'
|
||||||
|
|||||||
Reference in New Issue
Block a user