From 2fde84b8e56d5575d8e34ce89b773a379f308ad2 Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Tue, 24 Oct 2023 01:42:35 -0300 Subject: [PATCH] Alerter: handle case of no alerts --- src/components/widgets/Alerter.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/widgets/Alerter.vue b/src/components/widgets/Alerter.vue index e639f2b09..fd477fecc 100644 --- a/src/components/widgets/Alerter.vue +++ b/src/components/widgets/Alerter.vue @@ -4,9 +4,9 @@ ref="currentAlertBar" class="flex items-center justify-between p-1 overflow-hidden rounded cursor-pointer select-none whitespace-nowrap bg-slate-800/75" > -

{{ currentAlert.message }}

+

{{ currentAlert?.message }}

-

{{ formattedDate(currentAlert.time_created || new Date()) }}

+

{{ formattedDate(currentAlert?.time_created || new Date()) }}

{{ currentAlert.level.toUpperCase() }}

@@ -47,7 +47,7 @@ const alertPersistencyInterval = 10 // in seconds const formattedDate = (datetime: Date): string => format(datetime, 'HH:mm:ss') -const currentAlert = ref(alertStore.alerts[0]) +const currentAlert = ref(alertStore.alerts?.[0] ?? undefined) // eslint-disable-next-line no-undef let currentAlertInterval: NodeJS.Timer | undefined = undefined