From 45a6c49907a86d505771501d50ee844dbbe647f3 Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 3 Jun 2024 10:15:51 +0200 Subject: [PATCH] refactor: refs #5447 fix request --- src/pages/Travel/ExtraCommunityFilter.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/pages/Travel/ExtraCommunityFilter.vue b/src/pages/Travel/ExtraCommunityFilter.vue index 9b088a25b..c96ea19c2 100644 --- a/src/pages/Travel/ExtraCommunityFilter.vue +++ b/src/pages/Travel/ExtraCommunityFilter.vue @@ -36,24 +36,26 @@ const decrement = (paramsObj, key) => { paramsObj[key]--; }; -const warehouseAm = ref([]); +const warehousesAm = ref([]); const warehouses = async () => { const warehouses = await axios.get('Warehouses'); const countries = await axios.get('Countries'); - const continents = await axios.get('Continents'); + const continents = await axios.get('Continents', { + params: { + filter: { where: { code: 'AM' } }, + }, + }); const countryContinent = countries.data.reduce((acc, c) => { acc[c.id] = c.continentFk; return acc; }, {}); - const continentAMId = continents.data.find((continent) => continent.code === 'AM').id; - const countriesInAM = Object.keys(countryContinent).filter( - (countryId) => countryContinent[countryId] === continentAMId.toString() + (countryId) => countryContinent[countryId] === continents.data[0].id.toString() ); - warehouseAm.value = warehouses.data.filter((w) => + warehousesAm.value = warehouses.data.filter((w) => countriesInAM.includes(w.countryFk.toString()) ); }; @@ -178,7 +180,7 @@ warehouses(); :label="t('params.warehouseOutFk')" v-model="params.warehouseOutFk" @update:model-value="searchFn()" - :options="warehouseAm" + :options="warehousesAm" option-value="id" option-label="name" hide-selected