0
0
Fork 0

feat: add router.meta.moduleName as default param

This commit is contained in:
Javier Segarra 2024-05-29 12:12:40 +02:00
parent f9fa68b0b1
commit c5e2a40d3e
8 changed files with 9 additions and 12 deletions

View File

@ -6,7 +6,7 @@ import { buildFilter } from 'filters/filterPanel';
const arrayDataStore = useArrayDataStore(); 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 (!key) throw new Error('ArrayData: A key is required to use this composable');
if (!arrayDataStore.get(key)) arrayDataStore.set(key); if (!arrayDataStore.get(key)) arrayDataStore.set(key);

View File

@ -19,7 +19,7 @@ const { t } = useI18n();
const dms = ref({}); const dms = ref({});
const route = useRoute(); const route = useRoute();
const editDownloadDisabled = ref(false); const editDownloadDisabled = ref(false);
const invoiceIn = computed(() => useArrayData(route.meta.moduleName).store.data); const invoiceIn = computed(() => useArrayData().store.data);
const userConfig = ref(null); const userConfig = ref(null);
const invoiceId = computed(() => +route.params.id); const invoiceId = computed(() => +route.params.id);

View File

@ -13,7 +13,7 @@ import { toCurrency } from 'src/filters';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const arrayData = useArrayData(route.meta.moduleName); const arrayData = useArrayData();
const invoiceIn = computed(() => arrayData.store.data); const invoiceIn = computed(() => arrayData.store.data);
const rowsSelected = ref([]); const rowsSelected = ref([]);

View File

@ -11,9 +11,7 @@ import { useArrayData } from 'src/composables/useArrayData';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const currency = computed( const currency = computed(() => useArrayData().store.data?.currency?.code);
() => useArrayData(route.meta.moduleName).store.data?.currency?.code
);
const invoceInIntrastat = ref([]); const invoceInIntrastat = ref([]);
const rowsSelected = ref([]); const rowsSelected = ref([]);
const countries = ref([]); const countries = ref([]);

View File

@ -16,7 +16,7 @@ const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const entityId = computed(() => props.id || +route.params.id); 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 currency = computed(() => invoiceIn.value?.currency?.code);
const invoiceInUrl = ref(); const invoiceInUrl = ref();
const amountsNotMatch = ref(null); const amountsNotMatch = ref(null);

View File

@ -11,13 +11,12 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import CrudModel from 'src/components/CrudModel.vue'; import CrudModel from 'src/components/CrudModel.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue'; import VnCurrency from 'src/components/common/VnCurrency.vue';
const router = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const quasar = useQuasar(); const quasar = useQuasar();
const arrayData = useArrayData(router.meta.moduleName); const arrayData = useArrayData();
const invoiceIn = computed(() => arrayData.store.data); const invoiceIn = computed(() => arrayData.store.data);
const invoiceId = +router.params.id; const invoiceId = +useRoute().params.id;
const currency = computed(() => invoiceIn.value?.currency?.code); const currency = computed(() => invoiceIn.value?.currency?.code);
const expenses = ref([]); const expenses = ref([]);
const sageTaxTypes = ref([]); const sageTaxTypes = ref([]);

View File

@ -10,7 +10,7 @@ const { t } = useI18n();
defineExpose({ checkToBook }); defineExpose({ checkToBook });
const { store } = useArrayData(useRoute().meta.moduleName); const { store } = useArrayData();
async function checkToBook(id) { async function checkToBook(id) {
let directBooking = true; let directBooking = true;

View File

@ -54,7 +54,7 @@ const excludeType = computed({
}, },
}); });
const arrayData = useArrayData('ZoneEvents'); const arrayData = useArrayData();
const exclusionGeoCreate = async () => { const exclusionGeoCreate = async () => {
try { try {