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

@ -571,14 +571,13 @@ import http from "@/plugins/http";
import config from "@/app.config";
import HeaderTop from "@/modules/04_registry/components/Information/top.vue";
import ProfileTable from "@/modules/04_registry/components/Table.vue";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar";
const $q = useQuasar();
const mixin = useCounterMixin(); //
const store = useDataStore();
const { loaderPage } = store;
const { date2Thai, messageError } = mixin;
const { date2Thai, messageError, showLoader, hideLoader } = mixin;
const previous = ref<boolean>(false);
const next = ref<boolean>(false);
const addDialog = ref<boolean>(false);
@ -870,7 +869,7 @@ const saveEdit = async () => {
};
const saveDataAgency = async (data: DataLink[]) => {
loaderPage(true);
showLoader();
await http
.post(config.API.cmsAgency, data)
.then((res) => {})
@ -883,7 +882,7 @@ const saveDataAgency = async (data: DataLink[]) => {
};
const saveDataGoverment = async (data: DataLink[]) => {
loaderPage(true);
showLoader();
await http
.post(config.API.cmsGoverment, data)
@ -897,7 +896,7 @@ const saveDataGoverment = async (data: DataLink[]) => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.cms)
.then((res) => {
@ -952,12 +951,12 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const takeLogo = async () => {
loaderPage(true);
showLoader();
const formData = new FormData();
formData.append("FileData", imageFileLogo.value);
await http
@ -974,7 +973,7 @@ const takeLogo = async () => {
};
const takeBanner = async () => {
loaderPage(true);
showLoader();
const formData = new FormData();
formData.append("FileData", imageFile.value);
await http
@ -999,7 +998,7 @@ const sendDataDetail = async () => {
description: web.value.descripstion,
shortName: web.value.by,
};
loaderPage(true);
showLoader();
await http
.post(config.API.cmsDeatail, data)
.then((res) => {})
@ -1026,7 +1025,7 @@ const sendDataAbout = async () => {
zipCode: address.value.code,
telephone: address.value.tel,
};
loaderPage(true);
showLoader();
await http
.post(config.API.cmsAbout, data)
.then((res) => {})
@ -1042,7 +1041,7 @@ const sendDataAbout = async () => {
};
const fetchProvince = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.province)
.then((res) => {
@ -1057,13 +1056,13 @@ const fetchProvince = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchDistrict = async (id: string | null) => {
if (id !== null && id != "") {
loaderPage(true);
showLoader();
await http
.get(config.API.listDistrict(id))
.then((res) => {
@ -1078,14 +1077,14 @@ const fetchDistrict = async (id: string | null) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
const fetchSubDistrict = async (id: string | null) => {
if (id !== null && id != "") {
loaderPage(true);
showLoader();
await http
.get(config.API.listSubDistrict(id))
.then((res) => {
@ -1104,7 +1103,7 @@ const fetchSubDistrict = async (id: string | null) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};