fix(02): upload image

This commit is contained in:
puriphatt 2024-08-28 16:56:54 +07:00
parent 59436725f7
commit 7476133bef
2 changed files with 9 additions and 13 deletions

View file

@ -280,13 +280,14 @@ const useUserStore = defineStore('api-user', () => {
},
);
profileImage &&
(await axios
.put(res.data.profileImageUploadUrl, profileImage, {
if (profileImage && res.data.id) {
await api
.put(`/user/${res.data.id}/image`, profileImage, {
headers: { 'Content-Type': profileImage.type },
onUploadProgress: (e) => console.log(e),
})
.catch((e) => console.error(e)));
.catch((e) => console.error(e));
}
if (!res) return false;