new loader

This commit is contained in:
Thanit Konmek 2023-06-09 14:25:41 +07:00
parent fd7aae2f5d
commit fe6c712a18
95 changed files with 1189 additions and 950 deletions

View file

@ -351,7 +351,7 @@ 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 +360,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 +386,7 @@ const clickPreviousNext = async (page: string) => {
};
const fetchHistory = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.report2HistoryId(id.value))
.then((res) => {
@ -402,7 +402,7 @@ const fetchHistory = async () => {
})
.catch((e) => {})
.finally(async () => {
loaderPage(false);
hideLoader();
if (historyHead.value.length > 1) {
next.value = true;
previous.value = false;
@ -414,7 +414,7 @@ const fetchHistory = async () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(
config.API.report2HistoryDetailId(
@ -455,7 +455,7 @@ const fetchData = async () => {
})
.catch((e) => {})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
</script>