From c0a9b59d2695cf47cb0d4f92e2a153aa8d7fbdc0 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 18 Mar 2024 19:07:12 +0100 Subject: [PATCH] fix(settings): Show proper warning if app discover section could not be fetched Signed-off-by: Ferdinand Thiessen --- .../components/AppStoreDiscover/AppStoreDiscoverSection.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/settings/src/components/AppStoreDiscover/AppStoreDiscoverSection.vue b/apps/settings/src/components/AppStoreDiscover/AppStoreDiscoverSection.vue index 4072af9f719..5c167c22abd 100644 --- a/apps/settings/src/components/AppStoreDiscover/AppStoreDiscoverSection.vue +++ b/apps/settings/src/components/AppStoreDiscover/AppStoreDiscoverSection.vue @@ -64,6 +64,11 @@ const shuffleArray = (array: T[]): T[] => { onBeforeMount(async () => { try { const { data } = await axios.get[]>(generateUrl('/settings/api/apps/discover')) + if (data.length === 0) { + logger.info('No app discover elements available (empty response)') + hasError.value = true + return + } // Parse data to ensure dates are useable and then filter out expired or future elements const parsedElements = data.map(parseApiResponse).filter(filterElements) // Shuffle elements to make it looks more interesting