new loader

This commit is contained in:
Thanit Konmek 2023-06-09 14:25:41 +07:00
parent fd7aae2f5d
commit fe6c712a18
95 changed files with 1189 additions and 950 deletions

View file

@ -145,7 +145,7 @@ const { loaderPage } = dataStore;
const router = useRouter();
const $q = useQuasar();
const mixin = useCounterMixin(); //
const { success, dateToISO, messageError } = mixin;
const { success, dateToISO, messageError, showLoader, hideLoader } = mixin;
const route = useRoute();
const examId = ref<string>(route.params.examId.toString());
const candidateId = ref<string>(route.params.candidateId.toString());
@ -163,7 +163,7 @@ onMounted(async () => {
});
const fetchStatus = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateId(candidateId.value))
.then((res) => {
@ -174,12 +174,12 @@ const fetchStatus = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const confirm = async (status: boolean, reason: string) => {
loaderPage(true);
showLoader();
await http
.put(config.API.candidateCheckRegister(candidateId.value), {
status: status,
@ -190,14 +190,14 @@ const confirm = async (status: boolean, reason: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
success($q, "ตรวจสอบข้อมูลสำเร็จ");
router.push(`/qualify/manage/${examId.value}`);
});
};
const reject = async (reason: string) => {
loaderPage(true);
showLoader();
await http
.put(config.API.candidateRejectRegister(candidateId.value), {
reason: reason,
@ -207,7 +207,7 @@ const reject = async (reason: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
success($q, "ตรวจสอบข้อมูลสำเร็จ");
router.push(`/qualify/manage/${examId.value}`);
});
@ -253,7 +253,7 @@ const clickSave = async () => {
type.value = defaultOccupation.value.employee;
if (defaultOccupation.value.status == "other")
type.value = defaultOccupation.value.other;
loaderPage(true);
showLoader();
await http
.post(config.API.candidateId(candidateId.value), {
prefixId: defaultInformation.value.prefixId,
@ -329,7 +329,7 @@ const clickSave = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
}
});