diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index e2465f5ba..d9bcb4904 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -6,7 +6,7 @@ import { buildFilter } from 'filters/filterPanel'; const arrayDataStore = useArrayDataStore(); -export function useArrayData(key, userOptions) { +export function useArrayData(key = useRoute().meta.moduleName, userOptions) { if (!key) throw new Error('ArrayData: A key is required to use this composable'); if (!arrayDataStore.get(key)) arrayDataStore.set(key); diff --git a/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue b/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue index bd7d758b4..06e79340a 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue @@ -19,7 +19,7 @@ const { t } = useI18n(); const dms = ref({}); const route = useRoute(); const editDownloadDisabled = ref(false); -const invoiceIn = computed(() => useArrayData(route.meta.moduleName).store.data); +const invoiceIn = computed(() => useArrayData().store.data); const userConfig = ref(null); const invoiceId = computed(() => +route.params.id); diff --git a/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue b/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue index de59b142e..9325a5b41 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue @@ -13,7 +13,7 @@ import { toCurrency } from 'src/filters'; const route = useRoute(); const { t } = useI18n(); -const arrayData = useArrayData(route.meta.moduleName); +const arrayData = useArrayData(); const invoiceIn = computed(() => arrayData.store.data); const rowsSelected = ref([]); diff --git a/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue b/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue index 1d1205d9e..67c197636 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue @@ -11,9 +11,7 @@ import { useArrayData } from 'src/composables/useArrayData'; const { t } = useI18n(); const route = useRoute(); -const currency = computed( - () => useArrayData(route.meta.moduleName).store.data?.currency?.code -); +const currency = computed(() => useArrayData().store.data?.currency?.code); const invoceInIntrastat = ref([]); const rowsSelected = ref([]); const countries = ref([]); diff --git a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue index 3ee90b5c2..b7f8adf50 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue @@ -16,7 +16,7 @@ const { t } = useI18n(); const route = useRoute(); const entityId = computed(() => props.id || +route.params.id); -const invoiceIn = computed(() => useArrayData(route.meta.moduleName).store.data); +const invoiceIn = computed(() => useArrayData().store.data); const currency = computed(() => invoiceIn.value?.currency?.code); const invoiceInUrl = ref(); const amountsNotMatch = ref(null); diff --git a/src/pages/InvoiceIn/Card/InvoiceInVat.vue b/src/pages/InvoiceIn/Card/InvoiceInVat.vue index 6fc844eff..58f6e0d01 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInVat.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInVat.vue @@ -11,13 +11,12 @@ import VnSelect from 'src/components/common/VnSelect.vue'; import CrudModel from 'src/components/CrudModel.vue'; import VnCurrency from 'src/components/common/VnCurrency.vue'; -const router = useRoute(); const { t } = useI18n(); const quasar = useQuasar(); -const arrayData = useArrayData(router.meta.moduleName); +const arrayData = useArrayData(); const invoiceIn = computed(() => arrayData.store.data); -const invoiceId = +router.params.id; +const invoiceId = +useRoute().params.id; const currency = computed(() => invoiceIn.value?.currency?.code); const expenses = ref([]); const sageTaxTypes = ref([]); diff --git a/src/pages/InvoiceIn/InvoiceInToBook.vue b/src/pages/InvoiceIn/InvoiceInToBook.vue index 26fdb641b..1ab6ccdda 100644 --- a/src/pages/InvoiceIn/InvoiceInToBook.vue +++ b/src/pages/InvoiceIn/InvoiceInToBook.vue @@ -10,7 +10,7 @@ const { t } = useI18n(); defineExpose({ checkToBook }); -const { store } = useArrayData(useRoute().meta.moduleName); +const { store } = useArrayData(); async function checkToBook(id) { let directBooking = true; diff --git a/src/pages/Zone/Card/ZoneEventExclusionForm.vue b/src/pages/Zone/Card/ZoneEventExclusionForm.vue index c0247de4a..03fc157be 100644 --- a/src/pages/Zone/Card/ZoneEventExclusionForm.vue +++ b/src/pages/Zone/Card/ZoneEventExclusionForm.vue @@ -54,7 +54,7 @@ const excludeType = computed({ }, }); -const arrayData = useArrayData('ZoneEvents'); +const arrayData = useArrayData(); const exclusionGeoCreate = async () => { try {