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

@ -336,7 +336,7 @@ import { onMounted, ref } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useRouter, useRoute } from "vue-router";
import { useQuasar } from "quasar";
import { useDataStore } from "@/stores/data";
import http from "@/plugins/http";
import config from "@/app.config";
import type {
@ -344,14 +344,12 @@ import type {
ResponseHistoryHead,
} from "@/modules/02_organizational/interface/response/Mapping";
const dataStore = useDataStore();
const $q = useQuasar(); // show dia
const mixin = useCounterMixin();
const router = useRouter();
const route = useRoute();
const { loaderPage } = dataStore;
const { date2Thai, success, dateToISO } = mixin;
const { date2Thai, success, dateToISO, showLoader, hideLoader } = mixin;
const id = ref<string>("");
const previous = ref<boolean>(false);
const next = ref<boolean>(false);
@ -360,7 +358,7 @@ const historyHead = ref<ResponseHistoryHead[]>([]);
const historyData = ref<ResponseHistory[]>([]);
onMounted(async () => {
loaderPage(false);
hideLoader();
if (route.params.id != undefined) {
id.value = route.params.id.toString();
@ -386,7 +384,7 @@ const clickPreviousNext = async (page: string) => {
};
const fetchHistory = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.report2HistoryId(id.value))
.then((res) => {
@ -402,7 +400,7 @@ const fetchHistory = async () => {
})
.catch((e) => {})
.finally(async () => {
loaderPage(false);
hideLoader();
if (historyHead.value.length > 1) {
next.value = true;
previous.value = false;
@ -414,7 +412,7 @@ const fetchHistory = async () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(
config.API.report2HistoryDetailId(
@ -455,7 +453,7 @@ const fetchData = async () => {
})
.catch((e) => {})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
</script>