From a9e8ee349877fccb12446ae2b895f7549b222be3 Mon Sep 17 00:00:00 2001 From: jlpereira Date: Wed, 19 Mar 2025 12:49:56 -0300 Subject: [PATCH] Catch error responses --- .../Autocomplete/Autocomplete.global.vue | 1 + src/components/Gallery/useGallery.js | 1 + src/components/ProjectStats.global.vue | 17 ++++++++++------- .../Panel/PanelDescendants/PanelDescendants.vue | 1 + .../PanelMap/components/Search/OtuSearch.vue | 1 + .../PanelMap/store/useDistributionStore.js | 8 ++++---- .../PanelTypeSpecimen/PanelTypeSpecimen.vue | 16 +++++++++------- 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/components/Autocomplete/Autocomplete.global.vue b/src/components/Autocomplete/Autocomplete.global.vue index 58affca..f34238d 100644 --- a/src/components/Autocomplete/Autocomplete.global.vue +++ b/src/components/Autocomplete/Autocomplete.global.vue @@ -97,6 +97,7 @@ watch(typed, (newVal) => { isSearching.value = false list.value = data }) + .catch(() => {}) }, delay) } else { list.value = [] diff --git a/src/components/Gallery/useGallery.js b/src/components/Gallery/useGallery.js index 8493b40..9d41a18 100644 --- a/src/components/Gallery/useGallery.js +++ b/src/components/Gallery/useGallery.js @@ -38,6 +38,7 @@ export function useGallery({ props }) { props.depictionId.indexOf(b.id) ) }) + .catch(() => {}) } }, { immediate: true } diff --git a/src/components/ProjectStats.global.vue b/src/components/ProjectStats.global.vue index da8dc47..e97ffe0 100644 --- a/src/components/ProjectStats.global.vue +++ b/src/components/ProjectStats.global.vue @@ -54,13 +54,16 @@ function filterStats(currentStats) { } onMounted(() => { - makeAPIRequest.get('/stats').then((response) => { - const data = Object.entries(response.data.data).map(([key, value]) => [ - key.toLowerCase(), - value.toLocaleString() - ]) + makeAPIRequest + .get('/stats') + .then((response) => { + const data = Object.entries(response.data.data).map(([key, value]) => [ + key.toLowerCase(), + value.toLocaleString() + ]) - stats.value.data = data - }) + stats.value.data = data + }) + .catch(() => {}) }) diff --git a/src/modules/otus/components/Panel/PanelDescendants/PanelDescendants.vue b/src/modules/otus/components/Panel/PanelDescendants/PanelDescendants.vue index 1997a71..4fa335b 100644 --- a/src/modules/otus/components/Panel/PanelDescendants/PanelDescendants.vue +++ b/src/modules/otus/components/Panel/PanelDescendants/PanelDescendants.vue @@ -65,6 +65,7 @@ watch( .then(({ data }) => { taxonomy.value = data }) + .catch(() => {}) .finally(() => (isLoading.value = false)) }, { immediate: true } diff --git a/src/modules/otus/components/Panel/PanelMap/components/Search/OtuSearch.vue b/src/modules/otus/components/Panel/PanelMap/components/Search/OtuSearch.vue index ef2c317..482b7c9 100644 --- a/src/modules/otus/components/Panel/PanelMap/components/Search/OtuSearch.vue +++ b/src/modules/otus/components/Panel/PanelMap/components/Search/OtuSearch.vue @@ -136,6 +136,7 @@ function loadOTUs(geojson) { list.value = data isTableVisible.value = true }) + .catch(() => {}) .finally((_) => { isLoading.value = false }) diff --git a/src/modules/otus/components/Panel/PanelMap/store/useDistributionStore.js b/src/modules/otus/components/Panel/PanelMap/store/useDistributionStore.js index f4e57ee..d0ae517 100644 --- a/src/modules/otus/components/Panel/PanelMap/store/useDistributionStore.js +++ b/src/modules/otus/components/Panel/PanelMap/store/useDistributionStore.js @@ -45,11 +45,11 @@ export const useDistributionStore = defineStore('distributionStore', { }, loadCachedMap(mapId) { - TaxonWorks.getCachedMap(mapId, { signal: this.controller.signal }).then( - (response) => { + TaxonWorks.getCachedMap(mapId, { signal: this.controller.signal }) + .then((response) => { this.distribution.cachedMap = response.data - } - ) + }) + .catch(() => {}) }, async getAggregateShape(otuId) { diff --git a/src/modules/otus/components/Panel/PanelTypeSpecimen/PanelTypeSpecimen.vue b/src/modules/otus/components/Panel/PanelTypeSpecimen/PanelTypeSpecimen.vue index 5652f29..eb8f5d5 100644 --- a/src/modules/otus/components/Panel/PanelTypeSpecimen/PanelTypeSpecimen.vue +++ b/src/modules/otus/components/Panel/PanelTypeSpecimen/PanelTypeSpecimen.vue @@ -37,13 +37,15 @@ watch( useOtuPageRequest('panel:typeMaterial', () => TaxonWorks.getOtuTypeMaterial(props.otuId) - ).then(({ data }) => { - typeMaterials.value = data.type_materials_catalog_labels.sort( - (a, b) => - SPECIMEN_TYPES.indexOf(a.type_type) - - SPECIMEN_TYPES.indexOf(b.type_type) - ) - }) + ) + .then(({ data }) => { + typeMaterials.value = data.type_materials_catalog_labels.sort( + (a, b) => + SPECIMEN_TYPES.indexOf(a.type_type) - + SPECIMEN_TYPES.indexOf(b.type_type) + ) + }) + .catch(() => {}) }, { immediate: true } )