diff --git a/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue b/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue index eab68205e..f250c2cbb 100644 --- a/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue +++ b/src/modules/04_registryPerson/components/detail/GovernmentInformation/07_Position.vue @@ -307,7 +307,6 @@ const cardData = ref([ /** function fetch รายการ ตำแหน่งเงินเดือน*/ async function fetchListSalary() { - showLoader(); await http .get( config.API.profileListSalaryPositionNew(profileId.value, empType.value) @@ -318,9 +317,6 @@ async function fetchListSalary() { }) .catch((err) => { messageError($q, err); - }) - .finally(() => { - hideLoader(); }); } @@ -553,13 +549,13 @@ function onSubmit() { : config.API.profileSalaryPositionNew(empType.value); const method = isStatusEdit.value ? "patch" : "post"; await http[method](url, formData); - await onClickCloseDialog(); await fetchListSalary(); + await onClickCloseDialog(); success($q, "บันทึกข้อมูลสำเร็จ"); } catch (e) { messageError($q, e); - hideLoader(); } finally { + hideLoader(); } }); } @@ -753,9 +749,16 @@ async function fetchDataTenure() { } /** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/ -onMounted(() => { - fetchListSalary(); - empType.value === "" && fetchDataTenure(); +onMounted(async () => { + try { + showLoader(); + await Promise.all([ + fetchListSalary(), + empType.value === "" ? fetchDataTenure() : Promise.resolve(), + ]); + } finally { + hideLoader(); + } });