From 42913887de74817326c93f11c4105e1866b32ddc Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 24 Jun 2024 02:25:32 +0200 Subject: [PATCH] made sure that search and details apis retry --- webclient/components/AppSearchBar.vue | 22 ++++++++++++++++++---- webclient/pages/[view]/[id].vue | 8 +++++++- webclient/pages/search.vue | 8 +++++++- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/webclient/components/AppSearchBar.vue b/webclient/components/AppSearchBar.vue index 2faf790d6..5c97ee22c 100644 --- a/webclient/components/AppSearchBar.vue +++ b/webclient/components/AppSearchBar.vue @@ -114,10 +114,12 @@ const url = computed(() => { return `${runtimeConfig.public.apiURL}/api/search?${params.toString()}`; }); -const { data, error, refresh } = await useFetch(url, { key: "search", dedupe: "defer", deep: false }); -// a bit crude way of doing retries, but likely fine -watchEffect(() => { - if (query.value.length && error.value !== null) setTimeout(refresh, 5000); +const { data, error } = await useFetch(url, { + key: "search", + dedupe: "defer", + deep: false, + retry: 120, + retryDelay: 5000, }); @@ -168,6 +170,18 @@ watchEffect(() => { Suche einschränken auf: Räume --> + +

{{ t("error.header") }}

+

+ {{ t("error.reason") }}:
+ + {{ error }} + +

+

{{ t("error.call_to_action") }}

+
    {{ t(`sections.${s.facet}`) }} diff --git a/webclient/pages/[view]/[id].vue b/webclient/pages/[view]/[id].vue index f232ee0b8..5f9fda12e 100644 --- a/webclient/pages/[view]/[id].vue +++ b/webclient/pages/[view]/[id].vue @@ -21,7 +21,13 @@ const router = useRouter(); const runtimeConfig = useRuntimeConfig(); const url = computed(() => `${runtimeConfig.public.apiURL}/api/get/${route.params.id}?lang=${locale.value}`); -const { data, error } = useFetch(url, { key: "details", dedupe: "defer", deep: false }); +const { data, error } = useFetch(url, { + key: "details", + dedupe: "defer", + deep: false, + retry: 120, + retryDelay: 5000, +}); const shownImage = ref(data.value?.imgs?.length ? data.value.imgs[0] : undefined); const slideshowOpen = ref(false); diff --git a/webclient/pages/search.vue b/webclient/pages/search.vue index 4f5e91f1f..13160414c 100644 --- a/webclient/pages/search.vue +++ b/webclient/pages/search.vue @@ -29,7 +29,13 @@ const apiUrl = computed(() => { return `${runtimeConfig.public.apiURL}/api/search?${params.toString()}`; }); -const { data } = useFetch(apiUrl, { key: "search", dedupe: "defer", deep: false }); +const { data } = useFetch(apiUrl, { + key: "search", + dedupe: "defer", + deep: false, + retry: 120, + retryDelay: 5000, +}); const description = computed(() => { if (data.value === null) return ""; let sectionsDescr = "";