แก้ไข 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

@ -278,17 +278,14 @@ import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const filePayment = ref<File[]>([]);
const bank = ref<any>([]);
const fee = ref<number>();
const $q = useQuasar();
const router = useRouter();
const mixin = useCounterMixin(); //
const { success, messageError } = mixin;
const { success, messageError, showLoader, hideLoader } = mixin;
const route = useRoute();
const examId = ref<string>(route.params.examId.toString());
const candidateId = ref<string>(route.params.candidateId.toString());
@ -308,13 +305,13 @@ const props = defineProps({
});
onMounted(async () => {
loaderPage(false);
hideLoader();
await fetchPaymentExam();
await fetchData();
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.candidatePayment(candidateId.value))
.then((res) => {
@ -325,12 +322,12 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchPaymentExam = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamPayment(examId.value))
.then((res) => {
@ -342,12 +339,12 @@ const fetchPaymentExam = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const confirm = async (status: boolean, reason: string) => {
loaderPage(true);
showLoader();
await http
.put(config.API.candidateCheckPayment(candidateId.value), {
status: status,
@ -358,7 +355,7 @@ const confirm = async (status: boolean, reason: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
success($q, "ตรวจสอบข้อมูลชำระเงินสำเร็จ");
router.push(`/qualify/manage/${examId.value}`);
});