From cf4df9f0a433638f2bbc776b64a917d3de91b38b Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Thu, 22 Feb 2024 10:11:48 +0000 Subject: [PATCH] fix(nocodb): handle error in gui --- .../composables/useCalendarViewStore.ts | 30 ++++++++++--------- packages/nc-gui/lang/en.json | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/packages/nc-gui/composables/useCalendarViewStore.ts b/packages/nc-gui/composables/useCalendarViewStore.ts index f6efdc26b2..fedf1dfc82 100644 --- a/packages/nc-gui/composables/useCalendarViewStore.ts +++ b/packages/nc-gui/composables/useCalendarViewStore.ts @@ -514,21 +514,23 @@ const [useProvideCalendarViewStore, useCalendarViewStore] = useInjectionState( }) if (!base?.value?.id || !meta.value?.id || !viewMeta.value?.id) return - const res = !isPublic.value - ? await api.dbViewRow.calendarCount('noco', base.value.id!, meta.value!.id!, viewMeta.value.id, { - ...queryParams.value, - ...{}, - ...{}, - ...{ filterArrJson: JSON.stringify([...activeDateFilter]) }, - }) - : await fetchSharedViewActiveDate({ - sortsArr: sorts.value, - filtersArr: activeDateFilter, - }) - if (res) { + + try { + const res = !isPublic.value + ? await api.dbViewRow.calendarCount('noco', base.value.id!, meta.value!.id!, viewMeta.value.id, { + ...queryParams.value, + ...{}, + ...{}, + ...{ filterArrJson: JSON.stringify([...activeDateFilter]) }, + }) + : await fetchSharedViewActiveDate({ + sortsArr: sorts.value, + filtersArr: activeDateFilter, + }) activeDates.value = res.map((dateObj: unknown) => dayjs(dateObj)) - } else { - activeDates.value = [] + } catch (e) { + message.error(`${t('msg.error.fetchingActiveDates')} ${await extractSdkResponseErrorMsg(e)}`) + console.log(e) } } diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json index 61b23ad71a..096eafbece 100644 --- a/packages/nc-gui/lang/en.json +++ b/packages/nc-gui/lang/en.json @@ -1286,6 +1286,7 @@ "groupClearIsNotSupportedOnLinksColumn": "Group clear operation is not supported on Links/LinkToAnotherRecord column" }, "error": { + "fetchingActiveDates": "Error fetching active dates", "scopesRequired": "Scopes required", "authUrlRequired": "Auth URL is required", "userNameAttributeRequired": "Username attribute is required",