แก้ไข loader

This commit is contained in:
Thanit Konmek 2023-08-04 10:04:59 +07:00
parent f072224851
commit b663eedb09
147 changed files with 3095 additions and 3256 deletions

View file

@ -138,14 +138,11 @@ import { useRoute, useRouter } from "vue-router";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
const dataStore = useDataStore();
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 +160,7 @@ onMounted(async () => {
});
const fetchStatus = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidateId(candidateId.value))
.then((res) => {
@ -174,12 +171,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 +187,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 +204,7 @@ const reject = async (reason: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
success($q, "ตรวจสอบข้อมูลสำเร็จ");
router.push(`/qualify/manage/${examId.value}`);
});
@ -253,7 +250,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 +326,7 @@ const clickSave = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
}
});