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

@ -431,7 +431,8 @@ const { profileData, changeProfileColumns } = store;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError } = mixin;
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
const route = useRoute();
const id = ref<string>("");
const name = ref<string>();
@ -751,7 +752,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileTrainId(profileId.value))
.then((res) => {
@ -779,7 +780,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -872,7 +873,7 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.profileTrainId(profileId.value), {
id: id.value,
@ -903,7 +904,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.profileTrainId(id.value), {
id: id.value,
@ -942,7 +943,7 @@ const clickDelete = async () => {
persistent: true,
})
.onOk(async () => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profileTrainId(id.value))
.then((res) => {
@ -1062,7 +1063,7 @@ const clickEditRow = () => {
*/
const clickHistory = async (row: RequestItemsObject) => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileTrainHisId(row.id))
.then((res) => {
@ -1090,7 +1091,7 @@ const clickHistory = async (row: RequestItemsObject) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};