diff --git a/src/modules/04_registry/components/Profile.vue b/src/modules/04_registry/components/Profile.vue index 034d853d8..947e418fc 100644 --- a/src/modules/04_registry/components/Profile.vue +++ b/src/modules/04_registry/components/Profile.vue @@ -1021,27 +1021,60 @@ const closeKp7Short = () => { dialogShort.value = false; }; -const helpPost = () => { +const helpPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.placemenHelpGov, formData); + showLoader(); + await http + .post(config.API.placemenHelpGov, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; const repatriationPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.placemenRepatriation, formData); + showLoader(); + await http + .post(config.API.placemenRepatriation, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; const appointPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.placemenAppointment, formData); + showLoader(); + await http + .post(config.API.placemenAppointment, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; @@ -1054,34 +1087,78 @@ const appointPost = async () => { // }; const outPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.retirementOut, formData); + showLoader(); + await http + .post(config.API.retirementOut, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; const dischargePost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.retirementDischarge, formData); + showLoader(); + await http + .post(config.API.retirementDischarge, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; const expulsionPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.retirementExpulsion, formData); + showLoader(); + await http + .post(config.API.retirementExpulsion, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }; const otherPost = async () => { + const formData = new FormData(); + formData.append("id", profileId.value); dialogConfirm($q, async () => { - const formData = new FormData(); - formData.append("id", profileId.value); - await http.post(config.API.placemenOther, formData); + showLoader(); + await http + .post(config.API.placemenOther, formData) + .then(() => { + success($q, "ดำเนินการสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); };