diff --git a/src/modules/17_acting/views/main.vue b/src/modules/17_acting/views/main.vue index a04bac858..e76cce14f 100644 --- a/src/modules/17_acting/views/main.vue +++ b/src/modules/17_acting/views/main.vue @@ -48,7 +48,7 @@ async function fetchOrganizationActive() { nodeTree.value = await fetchTreeActing(""); } else { showLoader(); - http + await http .get(config.API.activeOrganization) .then(async (res) => { const data = res.data.result; @@ -154,9 +154,7 @@ const columns = ref([ ]); const keyword = ref(""); -/** - * function fetch รายชื่อ - */ +/**function fetch รายชื่อ*/ async function fetchPosMaster() { await http .post(config.API.orgPosAct + `/search`, { @@ -209,9 +207,7 @@ const rowListPerson = ref([]); const dataListPerson = ref([]); const keywordAct = ref(""); -/** - * function fetch รายชื่อรักษาการ - */ +/** function fetch รายชื่อรักษาการ*/ async function fetchListAct() { await http .get(config.API.orgPosAct + `/${posmasterId.value}`) @@ -267,21 +263,19 @@ function onDelete(id: string) { }); } -function getWorkFlow() { - showLoader(); - http - .get(config.API.workflowKeycloakSystem("SYS_ACTING")) - .then((res) => { - const data = res.data.result; - storeActing.isOfficer = data.isOfficer; - storeActing.isStaff = data.isStaff; - hideLoader(); - }) - .catch((e) => { - messageError($q, e); - hideLoader(); - }) - .finally(() => {}); +async function getWorkFlow() { + if (storeActing.isOfficer == null && storeActing.isStaff == null) { + await http + .get(config.API.workflowKeycloakSystem("SYS_ACTING")) + .then((res) => { + const data = res.data.result; + storeActing.isOfficer = data.isOfficer; + storeActing.isStaff = data.isStaff; + }) + .catch((e) => { + messageError($q, e); + }); + } } function onSearchRowPosition() { @@ -300,10 +294,14 @@ function onSearchListPerson() { ); } -onMounted(() => { - fetchOrganizationActive(); - if (storeActing.isOfficer == null && storeActing.isStaff == null) { - getWorkFlow(); +onMounted(async () => { + try { + showLoader(); + await Promise.all([fetchOrganizationActive(), getWorkFlow()]); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); } });