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