112. Update profile image service call (#13)
This commit is contained in:
@ -109,7 +109,7 @@ public class UserResource {
|
||||
}
|
||||
|
||||
@PutMapping("{username}/profileImage")
|
||||
public User updateUser(@PathVariable String username, MultipartFile profileImage) {
|
||||
public User updateProfileImage(@PathVariable String username, MultipartFile profileImage) {
|
||||
return userService.updateProfileImage(username, profileImage);
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {environment} from "../../environments/environment";
|
||||
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
|
||||
import {HttpClient, HttpErrorResponse, HttpEvent} from "@angular/common/http";
|
||||
import {Observable} from "rxjs";
|
||||
import {User} from "../model/user";
|
||||
|
||||
@ -35,6 +35,15 @@ export class UserService {
|
||||
.post<HttpResponse>(`${this.host}/user/resetPassword/${email}`, null);
|
||||
}
|
||||
|
||||
public updateProfileImage(username: string, formData: FormData): Observable<HttpEvent<User | HttpErrorResponse>> {
|
||||
return this.httpClient
|
||||
.put<User | HttpErrorResponse>(`${this.host}/user/${username}/profileImage`, formData,
|
||||
{
|
||||
reportProgress: true,
|
||||
observe: 'events'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface UserPage {
|
||||
|
||||
Reference in New Issue
Block a user