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

@ -298,9 +298,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);
@ -374,7 +382,7 @@ onMounted(async () => {
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
showLoader();
await http
.get(config.API.profileAvatarId(profileId.value))
.then((res) => {
@ -398,14 +406,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) => {
@ -416,14 +424,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) => {
@ -443,7 +451,7 @@ const fetchAvatarHistory = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
@ -454,7 +462,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) => {})
@ -471,7 +479,7 @@ const uploadImage = async (e: any) => {
};
const fetchDataDelete = async (id: string) => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profileAvatarHistoryId(id))
.then((res) => {
@ -517,7 +525,7 @@ const selectAvatarHistory = async () => {
return;
}
if (profileId.value !== "") {
loaderPage(true);
showLoader();
await http
.put(config.API.profileAvatarId(profileId.value), {
avatar: activeImage.value.avatarId,
@ -588,7 +596,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) => {
@ -601,7 +609,7 @@ const clickKp7 = async () => {
// })
// .catch((e) => {messageError($q, e);})
// .finally(() => {
// loaderPage(false);
// hideLoader();
// });
};
@ -609,7 +617,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) => {
@ -622,7 +630,7 @@ const clickKp7Short = async () => {
// })
// .catch((e) => {messageError($q, e);})
// .finally(() => {
// loaderPage(false);
// hideLoader();
// });
};
</script>