feat: update user with new avatar file name
This commit is contained in:
parent
f0f1567297
commit
c87d6b176b
1 changed files with 5 additions and 1 deletions
|
|
@ -161,12 +161,16 @@ export function Profile() {
|
||||||
const userPhotoUploadForm = new FormData();
|
const userPhotoUploadForm = new FormData();
|
||||||
userPhotoUploadForm.append('avatar', photoFile);
|
userPhotoUploadForm.append('avatar', photoFile);
|
||||||
|
|
||||||
await api.patch('/users/avatar', userPhotoUploadForm, {
|
const avatarUpdateResponse = await api.patch('/users/avatar', userPhotoUploadForm, {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'multipart/form-data',
|
'Content-Type': 'multipart/form-data',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const userUpdated = user;
|
||||||
|
userUpdated.avatar = avatarUpdateResponse.data.avatar;
|
||||||
|
updateUserData(userUpdated);
|
||||||
|
|
||||||
toast.show({
|
toast.show({
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
render: ({ id }) => (
|
render: ({ id }) => (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue