From 2dc75db12282cad63f45faf27283ef1dfb82d3a4 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 9 Jul 2024 12:11:10 +0200 Subject: [PATCH] feat: unnecessary changes --- src/components/ui/VnPaginate.vue | 10 +--------- src/composables/useArrayData.js | 17 ----------------- src/pages/Shelving/Card/ShelvingForm.vue | 12 ++++++------ 3 files changed, 7 insertions(+), 32 deletions(-) diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index a81e12f12..fd903e759 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -2,8 +2,6 @@ import { onBeforeUnmount, onMounted, ref, watch } from 'vue'; import { useI18n } from 'vue-i18n'; import { useArrayData } from 'composables/useArrayData'; -import { useRoute, onBeforeRouteUpdate } from 'vue-router'; -const route = useRoute(); const { t } = useI18n(); @@ -120,13 +118,7 @@ watch( () => props.url, (url) => fetch({ url }) ); -onBeforeRouteUpdate((to, from, next) => { - if (to.params.id !== from.params.id) { - arrayData.reloadRoute(to.params.id); - fetch(); - } - next(); -}); + const addFilter = async (filter, params) => { await arrayData.addFilter({ filter, params }); }; diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 28ec0b6c5..0fcbbbb48 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -33,22 +33,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { if (key && userOptions) setOptions(); - function reloadRoute(newId = route.params.id) { - if (route.path === store.url) return; - //Así fuerzo al reinicio - store.data = null; - if (!store?.filter?.where) { - //Cuando el cambio viene por VnSearchbar - if (newId) store.url = store.url.replace(/(\d+)/, newId); - return; - } - // Cuando el usuario cambia en la URL - const keyFk = Object.keys(store.filter.where).find((key) => key.endsWith('Fk')); - if (keyFk) { - store.filter.where[keyFk] = newId; - } - } - function setOptions() { const allowedOptions = [ 'url', @@ -265,6 +249,5 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { isLoading, deleteOption, reset, - reloadRoute, }; } diff --git a/src/pages/Shelving/Card/ShelvingForm.vue b/src/pages/Shelving/Card/ShelvingForm.vue index 40d591505..ff23e0d00 100644 --- a/src/pages/Shelving/Card/ShelvingForm.vue +++ b/src/pages/Shelving/Card/ShelvingForm.vue @@ -1,6 +1,6 @@