refactor: update user image
This commit is contained in:
parent
e6052e087b
commit
05bc85b840
1 changed files with 18 additions and 6 deletions
|
|
@ -115,13 +115,25 @@ const useUserStore = defineStore('api-user', () => {
|
|||
transactionId: string;
|
||||
},
|
||||
) {
|
||||
const res = await api.put<User>(`/user/${id}`, data, {
|
||||
headers: {
|
||||
'X-Session-Id': flow?.sessionId,
|
||||
'X-Rtid': flow?.refTransactionId,
|
||||
'X-Tid': flow?.transactionId,
|
||||
const res = await api.put<User & { profileImageUploadUrl: string }>(
|
||||
`/user/${id}`,
|
||||
data,
|
||||
{
|
||||
headers: {
|
||||
'X-Session-Id': flow?.sessionId,
|
||||
'X-Rtid': flow?.refTransactionId,
|
||||
'X-Tid': flow?.transactionId,
|
||||
},
|
||||
},
|
||||
});
|
||||
);
|
||||
|
||||
if (data.profileImage)
|
||||
await axios
|
||||
.put(res.data.profileImageUploadUrl, data.profileImage, {
|
||||
headers: { 'Content-Type': data.profileImage.type },
|
||||
onUploadProgress: (e) => console.log(e),
|
||||
})
|
||||
.catch((e) => console.error(e));
|
||||
|
||||
if (!res) return false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue