From 7292dca197c39bbc340710903cd34d87fa294631 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 10 Jun 2024 12:10:14 +0200 Subject: [PATCH] feat: remove fetchData to nativeCmp --- src/components/FetchData.vue | 4 ++-- src/pages/Worker/Card/WorkerLocker.vue | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/components/FetchData.vue b/src/components/FetchData.vue index cc87af653..7c754e13a 100644 --- a/src/components/FetchData.vue +++ b/src/components/FetchData.vue @@ -36,10 +36,10 @@ const $props = defineProps({ const emit = defineEmits(['onFetch']); defineExpose({ fetch }); -const fetchData = useFetchData({ ...$props }); +// const fetchData = useFetchData({ ...$props }); onMounted(async () => { if ($props.autoLoad) { - await fetchData.fetch(); + await fetch(); } }); diff --git a/src/pages/Worker/Card/WorkerLocker.vue b/src/pages/Worker/Card/WorkerLocker.vue index f19fc8ae6..6e9cfba38 100644 --- a/src/pages/Worker/Card/WorkerLocker.vue +++ b/src/pages/Worker/Card/WorkerLocker.vue @@ -7,11 +7,10 @@ import { useRole } from 'src/composables/useRole'; import FormModel from 'components/FormModel.vue'; import VnSelect from 'src/components/common/VnSelect.vue'; import { useArrayData } from 'src/composables/useArrayData'; -import FetchData from 'components/FetchData.vue'; +import { useAxios } from 'src/composables/useAxios'; const { hasAny } = useRole(); const { t } = useI18n(); -const fetchData = ref(); const originaLockerId = ref(); const lockers = ref([]); const { store } = useArrayData('Worker'); @@ -27,21 +26,14 @@ const save = async (data) => { const lockerId = data.id ?? originaLockerId.value; const workerFk = lockerId == originaLockerId.value ? null : entityId.value; - return axios.patch(`Lockers/${lockerId}`, { workerFk }); + return useAxios(`Lockers/${lockerId}`).push('PATCH', { workerFk }); }; const init = async (data) => { - await fetchData.value.fetch(); originaLockerId.value = data.id; };