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

@ -521,9 +521,17 @@ import config from "@/app.config";
const $q = useQuasar();
const store = useDataStore();
const { changeTab, loaderPage } = store;
const { changeTab } = store;
const mixin = useCounterMixin();
const { date2Thai, dateToISO, messageError, dialogMessage, success } = mixin;
const {
date2Thai,
dateToISO,
messageError,
dialogMessage,
success,
showLoader,
hideLoader,
} = mixin;
const route = useRoute();
const router = useRouter();
const imageUrl = ref<any>(null);
@ -603,7 +611,7 @@ onMounted(async () => {
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
showLoader();
await http
.get(config.API.profileAvatarId(profileId.value))
.then((res) => {
@ -627,14 +635,14 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
const checkProfileData = async () => {
if (profileId.value !== "") {
loaderPage(true);
showLoader();
await http
.get(config.API.profileCheckId(profileId.value))
.then((res) => {
@ -645,14 +653,14 @@ const checkProfileData = async () => {
router.push("/registry");
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
const fetchAvatarHistory = async () => {
if (profileId.value !== "") {
loaderPage(true);
showLoader();
await http
.get(config.API.profileAvatarHistoryId(profileId.value))
.then((res) => {
@ -672,7 +680,7 @@ const fetchAvatarHistory = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
@ -683,7 +691,7 @@ const uploadImage = async (e: any) => {
if (input.length > 0) {
const formData = new FormData();
formData.append("FileData", input[0]);
loaderPage(true);
showLoader();
await http
.post(config.API.profileAvatarId(profileId.value), formData)
.then((res) => {})
@ -700,7 +708,7 @@ const uploadImage = async (e: any) => {
};
const fetchDataDelete = async (id: string) => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profileAvatarHistoryId(id))
.then((res) => {
@ -746,7 +754,7 @@ const selectAvatarHistory = async () => {
return;
}
if (profileId.value !== "") {
loaderPage(true);
showLoader();
await http
.put(config.API.profileAvatarId(profileId.value), {
avatar: activeImage.value.avatarId,
@ -817,7 +825,7 @@ const clickKp7 = async () => {
if (profileId.value !== "") {
window.open(config.API.profileReportId(profileId.value));
}
// loaderPage(true);
// showLoader();
// await http
// .get(config.API.profileReportId(profileId.value))
// .then((res) => {
@ -830,7 +838,7 @@ const clickKp7 = async () => {
// })
// .catch((e) => {messageError($q, e);})
// .finally(() => {
// loaderPage(false);
// hideLoader();
// });
};
@ -851,7 +859,7 @@ const clickKp7Short = async () => {
if (profileId.value !== "") {
window.open(config.API.profileKp7ShortId(profileId.value));
}
// loaderPage(true);
// showLoader();
// await http
// .get(config.API.profileKp7ShortId(profileId.value))
// .then((res) => {
@ -864,7 +872,7 @@ const clickKp7Short = async () => {
// })
// .catch((e) => {messageError($q, e);})
// .finally(() => {
// loaderPage(false);
// hideLoader();
// });
};
@ -894,7 +902,7 @@ const clickRetire = async () => {
const Retire = async () => {
if (profileId.value !== "") {
if (reasonStatus.value == true) {
loaderPage(true);
showLoader();
await http
.put(config.API.profileReactive(profileId.value))
.then((res) => {
@ -909,7 +917,7 @@ const Retire = async () => {
router.push("/registry");
});
} else {
loaderPage(true);
showLoader();
await http
.put(config.API.profileDeactive(profileId.value), {
leaveDate: dateToISO(leaveDate.value),