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

@ -466,7 +466,8 @@ const { profileData, changeProfileColumns } = store;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { success, dateToISO, date2Thai, messageError } = mixin;
const { success, dateToISO, date2Thai, messageError, showLoader, hideLoader } =
mixin;
const route = useRoute();
const id = ref<string>("");
const levelId = ref<string>();
@ -896,7 +897,7 @@ onMounted(async () => {
});
const fetchLevel = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.educationLevel)
.then((res) => {
@ -912,12 +913,12 @@ const fetchLevel = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchPositionPath = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.positionPath)
.then((res) => {
@ -933,7 +934,7 @@ const fetchPositionPath = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -960,7 +961,7 @@ const filterSelector = (val: any, update: Function, refData: string) => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileEduId(profileId.value))
.then((res) => {
@ -994,7 +995,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1097,7 +1098,7 @@ const saveData = async () => {
// const filterPositionPath = OpsFilter.value.positionPathOptions.filter(
// (r: any) => r.id == positionPathId.value
// );
loaderPage(true);
showLoader();
await http
.post(config.API.profileEduId(profileId.value), {
id: id.value,
@ -1139,7 +1140,7 @@ const editData = async () => {
// const filterPositionPath = OpsFilter.value.positionPathOptions.filter(
// (r: any) => r.id == positionPathId.value
// );
loaderPage(true);
showLoader();
await http
.put(config.API.profileEduId(id.value), {
id: id.value,
@ -1183,7 +1184,7 @@ const clickDelete = async () => {
persistent: true,
})
.onOk(async () => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profileEduId(id.value))
.then((res) => {
@ -1311,7 +1312,7 @@ const clickEditRow = () => {
*/
const clickHistory = async (row: RequestItemsObject) => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileEduHisId(row.id))
.then((res) => {
@ -1345,7 +1346,7 @@ const clickHistory = async (row: RequestItemsObject) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};