loading สรรหา

This commit is contained in:
setthawutttty 2025-07-07 15:18:37 +07:00
parent ee4428aac2
commit 360caae2e1
8 changed files with 98 additions and 156 deletions

View file

@ -30,6 +30,7 @@ const {
hideLoader,
messageError,
onSearchDataTable,
dialogRemove,
} = mixin;
const router = useRouter();
@ -174,7 +175,7 @@ function textDate(value: Date) {
}
/** ดึงข้อมูล รอบสอบแข่งขัน */
async function fetchData() {
async function fetchData(actionType?: string) {
showLoader();
await http
.get(config.API.getCandidates)
@ -199,6 +200,9 @@ async function fetchData() {
})
.finally(() => {
hideLoader();
if (actionType == "delete") {
success($q, "ลบข้อมูลการสอบสำเร็จ");
}
});
}
@ -325,32 +329,18 @@ async function clickHistory(id: string) {
* @param id รอบสอบเเขงข
*/
function clickDelete(id: string) {
$q.dialog({
title: "ยืนยันการลบข้อมูล",
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
showLoader();
await http
.delete(config.API.deleteCandidates(id))
.then((res) => {
success($q, "ลบข้อมูลการสอบสำเร็จ");
fetchData();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
})
.onCancel(() => {})
.onDismiss(() => {});
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.deleteCandidates(id))
.then(async (res) => {
await fetchData("delete");
})
.catch((e) => {
messageError($q, e);
hideLoader();
});
});
}
/** ไปหน้าเพิ่มรอบสอบแข่งขัน */