diff --git a/src/modules/11_discipline/components/1_Complaint/Form.vue b/src/modules/11_discipline/components/1_Complaint/Form.vue index 7cbfd831f..aeda613a6 100644 --- a/src/modules/11_discipline/components/1_Complaint/Form.vue +++ b/src/modules/11_discipline/components/1_Complaint/Form.vue @@ -220,9 +220,10 @@ async function getActive() { }) .catch((err) => { messageError($q, err); - hideLoader(); }) - .finally(() => {}); + .finally(() => { + hideLoader(); + }); } else { await getOc(formData.activeId); } @@ -230,6 +231,7 @@ async function getActive() { /** ดึงข้อมูลหน่วยงานจาก api */ async function getOc(activeId: string) { + showLoader(); await http .get(config.API.orgByIdSystem(activeId, route.meta.Key as string)) .then(async (res) => { @@ -242,7 +244,9 @@ async function getOc(activeId: string) { .catch((err) => { messageError($q, err); }) - .finally(() => {}); + .finally(() => { + hideLoader(); + }); } /** @@ -257,9 +261,8 @@ function deletePerson(id: string) { } /** ช่องทางการร้องเรียน และฟังก์ชั่นการดึงข้อมูลช่องทางการร้องเรียนมาจาก api*/ - -async function getListChannel() { - await http +function getListChannel() { + http .get( config.API.complaintListOp( mainStore.pathComplaintsChannal(route.name as string) @@ -267,6 +270,9 @@ async function getListChannel() { ) .then((res) => { channelOptions.value = res.data.result.data; + }) + .catch((err) => { + messageError($q, err); }); } @@ -377,8 +383,7 @@ watch(props.data, async () => { /** โหลดข้อมูลเมื่อเข้าหน้านี้ */ onMounted(async () => { mainStore.rowsAdd = []; - await getActive(); - await getListChannel(); + await Promise.all([getActive(), getListChannel()]); });