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

@ -323,7 +323,7 @@ const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, messageError } = mixin;
const { date2Thai, success, messageError, showLoader, hideLoader } = mixin;
const edit = ref<boolean>(false);
const addressData = ref<Address>(defaultAddress);
const myform = ref<any>();
@ -561,7 +561,7 @@ const filterSelector = (val: any, update: Function, refData: string) => {
*/
const clickHistory = async () => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileAdrsHisId(route.params.id.toString()))
.then((res) => {
@ -589,7 +589,7 @@ const clickHistory = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -610,7 +610,7 @@ const getNewData = async () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileAdrsId(route.params.id.toString()))
.then((res) => {
@ -629,7 +629,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -661,7 +661,7 @@ const editData = async () => {
createdAt: new Date(),
createdFullName: "-",
};
loaderPage(true);
showLoader();
await http
.put(config.API.profileAdrsId(route.params.id.toString()), body)
.then((res) => {
@ -731,7 +731,7 @@ const selectSubDistrict = (e: string | null, name: string) => {
};
const fetchProvince = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.province)
.then((res) => {
@ -747,13 +747,13 @@ const fetchProvince = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchDistrict = async (id: string | null, position: string) => {
if (id != null) {
loaderPage(true);
showLoader();
await http
.get(config.API.listDistrict(id))
.then((res) => {
@ -774,14 +774,14 @@ const fetchDistrict = async (id: string | null, position: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
const fetchSubDistrict = async (id: string | null, position: string) => {
if (id != null) {
loaderPage(true);
showLoader();
await http
.get(config.API.listSubDistrict(id))
.then((res) => {
@ -806,7 +806,7 @@ const fetchSubDistrict = async (id: string | null, position: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};