diff --git a/src/modules/05_placement/components/Other/Detail.vue b/src/modules/05_placement/components/Other/Detail.vue index 5a44705ae..d95c597f1 100644 --- a/src/modules/05_placement/components/Other/Detail.vue +++ b/src/modules/05_placement/components/Other/Detail.vue @@ -53,7 +53,7 @@ const militaryDate = ref(null); const reason = ref(""); //-----(fetch data by id)-----// -const fecthOther = async () => { +const fetchData = async () => { showLoader(); await http .get(config.API.otherByid(paramsId.toString())) @@ -91,7 +91,7 @@ const fecthOther = async () => { const onSubmit = async () => { dialogConfirm( $q, - async () => { + () => { let data = { educationOld: educationOld.value, organizationPositionOld: organizationPositionOld.value, @@ -105,14 +105,15 @@ const onSubmit = async () => { }; await http .put(config.API.otherByid(paramsId.toString()), data) - .then(() => { - success($q, "แก้ไข้ข้อมูลสำเร็จ"); + .then(async () => { + await fetchData(); + await success($q, "แก้ไข้ข้อมูลสำเร็จ"); }) .catch((e) => { messageError($q, e); }) - .finally(async () => { - await fecthOther(); + .finally(() => { + hideLoader(); }); }, "ต้องการแก้ไขข้อมูลหรือไม่?", @@ -122,7 +123,7 @@ const onSubmit = async () => { const cancel = () => { edit.value = false; - fecthOther(); + fetchData(); myForm.value?.resetValidation(); }; @@ -137,7 +138,7 @@ onMounted(async () => { if (keycloak.tokenParsed != null) { roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1"); } - await fecthOther(); + await fetchData(); });