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

@ -138,7 +138,7 @@ import { onMounted, computed, ref, watch } from "vue";
import { useQuasar, QForm } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import { useDataStore } from "@/stores/data";
import HeaderTop from "@/modules/04_registry/components/Information/top.vue";
import http from "@/plugins/http";
import config from "@/app.config";
@ -156,12 +156,10 @@ const props = defineProps({
});
const emit = defineEmits(["update:statusEdit"]);
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const route = useRoute();
const { success, messageError } = mixin;
const { success, messageError, showLoader, hideLoader } = mixin;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
@ -177,7 +175,7 @@ onMounted(async () => {
const getData = async () => {
if (profileId.value) {
loaderPage(true);
showLoader();
await http
.get(config.API.profilePaperId(profileId.value))
.then((res) => {
@ -188,13 +186,13 @@ const getData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
const deleteData = async (id: string) => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profilePaperId(id))
.then((res) => {
@ -219,7 +217,7 @@ const uploadData = async () => {
formData.append("avatar", newFile);
formData.append("moss", "newFile");
console.log(formData);
loaderPage(true);
showLoader();
await http
.post(config.API.profilePaperId(profileId.value), formData)
.then((res) => {