diff --git a/src/modules/04_registryPerson/views/detailView.vue b/src/modules/04_registryPerson/views/detailView.vue index 180a28f50..e81ff334f 100644 --- a/src/modules/04_registryPerson/views/detailView.vue +++ b/src/modules/04_registryPerson/views/detailView.vue @@ -80,11 +80,6 @@ const baseItemsMenu = ref([ name: "ช่วยราชการ", system: "SYS_TEMPDUTY", }, - // { - // id: "2", - // name: "ส่งตัวกลับ", - // system: "SYS_TEMPDUTY2", - // }, { id: "3", name: "แต่งตั้ง-เลื่อน-ย้าย", @@ -237,7 +232,7 @@ async function uploadImg() { showLoader(); newProfileFile.value = await resizeImage(profileFile.value); closeImage(); - http + await http .post(config.API.orgProfileAvatarbyType(empType.value), { profileId: empType.value == "" ? profileId.value : undefined, profileEmployeeId: empType.value !== "" ? profileId.value : undefined, @@ -248,6 +243,8 @@ async function uploadImg() { }) .catch((e) => { messageError($q, e); + }) + .finally(() => { hideLoader(); }); } @@ -628,8 +625,11 @@ function openDialogImg() { /** ฟังก์ชันเรียกข้อมูลรูป*/ async function getImage() { showLoader(); - http - .get(config.API.orgProfileAvatar + `/${profileId.value}`) + images.value = []; + await http + .get( + config.API.orgProfileAvatarbyType(empType.value) + `/${profileId.value}` + ) .then(async (res) => { let data = res.data.result; if (!data || !Array.isArray(data)) { @@ -685,14 +685,14 @@ function closeImage() { function deletePhoto(id: string) { dialogRemove( $q, - () => { + async () => { showLoader(); - http - .delete(config.API.orgProfileAvatar + `/${id}`) + images.value = []; + imagesAlldata.value = []; + await http + .delete(config.API.orgProfileAvatarbyType(empType.value) + `/${id}`) .then(async () => { await getImage(); - images.value = []; - imagesAlldata.value = []; }) .catch((e) => { messageError($q, e); @@ -714,7 +714,10 @@ function selectAvatarHistory() { const data = activeImage.value; showLoader(); http - .get(config.API.orgProfileAvatar + `/select/${profileId.value}/${data.id}`) + .get( + config.API.orgProfileAvatarbyType(empType.value) + + `/select/${profileId.value}/${data.id}` + ) .then(async () => { await fetchDataPersonal(); await fetchProfile(profileId.value);