diff --git a/src/pages/02_personnel-management/MainPage.vue b/src/pages/02_personnel-management/MainPage.vue index 179a1e95..822281a4 100644 --- a/src/pages/02_personnel-management/MainPage.vue +++ b/src/pages/02_personnel-management/MainPage.vue @@ -287,9 +287,9 @@ const columns = [ }, ] satisfies QTableProps['columns']; -watch(profileFileImg, () => { - if (profileFileImg.value) reader.readAsDataURL(profileFileImg.value); -}); +// watch(profileFileImg, () => { +// if (profileFileImg.value) reader.readAsDataURL(profileFileImg.value); +// }); async function openDialog( action?: 'FORM' | 'INFO', @@ -392,11 +392,7 @@ function onClose() { flowStore.rotate(); } async function onSubmit() { - if (profileSubmit.value) { - formData.value.profileImage = profileFileImg.value as File; - } else { - formData.value.profileImage = null; - } + formData.value.profileImage = profileFileImg.value as File; if (isEdit.value && userId.value) { if (!userId.value) return; @@ -445,7 +441,6 @@ async function onSubmit() { : hqId.value ? hqId.value : ''; - const result = await userStore.create(formData.value); if (result && formData.value.userType === 'AGENCY') { diff --git a/src/stores/user/index.ts b/src/stores/user/index.ts index 3bc35e07..47bf33de 100644 --- a/src/stores/user/index.ts +++ b/src/stores/user/index.ts @@ -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;