This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-02 17:09:25 +07:00
parent ea4638d54f
commit 30a40ccd5c

View file

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