From 1915538e5eaadd95dc54bec1d937fe23fe84ccdb Mon Sep 17 00:00:00 2001 From: waruneeta Date: Mon, 12 Feb 2024 11:28:26 +0700 Subject: [PATCH] fix bug --- src/components/DialogAddEmployee.vue | 38 +++++++++++++--------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/components/DialogAddEmployee.vue b/src/components/DialogAddEmployee.vue index d79c28f49..5d2867cba 100644 --- a/src/components/DialogAddEmployee.vue +++ b/src/components/DialogAddEmployee.vue @@ -186,9 +186,9 @@ const calRetire = async (birth: Date) => { dateBefore.value = birth; }) .catch((e: any) => { - messageError($q, e); - informaData.value.birthDate = null; - informaData.value.age = ""; + messageError($q, e); + informaData.value.birthDate = null; + informaData.value.age = ""; }) .finally(() => { // hideLoader(); @@ -244,24 +244,20 @@ const addData = async () => { if (informaData.value.employeeClass != undefined) formData.append("employeeClass", informaData.value.employeeClass); - console.log("informaData===>", informaData.value); - // showLoader(); - // await http - // .post(config.API.createProfileOfficer(), formData) - // .then((res) => { - // success($q, "บันทึกข้อมูลสำเร็จ"); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(async () => { - // modal.value = false; - // await changeBirth( - // new Date(dateToPost(new Date(informaData.value.birthDate))) ?? - // new Date() - // ); - // hideLoader(); - // }); + showLoader(); + await http + .post(config.API.createProfileOfficer(), formData) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + modal.value = false; + await changeBirth(new Date(informaData.value.birthDate) ?? new Date()); + hideLoader(); + }); }; /*** get รายการข้อมูลเกี่ยวกับบุคคล (dropdown list) */