From f2b433b8a46659d59e345fc49c355f9e16b774e2 Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Sun, 17 Aug 2025 09:40:40 +0200 Subject: [PATCH] Fix jwt-token --- client/src/contexts/SocketContext.jsx | 28 ++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/client/src/contexts/SocketContext.jsx b/client/src/contexts/SocketContext.jsx index e4b3a7f..76202e7 100644 --- a/client/src/contexts/SocketContext.jsx +++ b/client/src/contexts/SocketContext.jsx @@ -87,20 +87,22 @@ export const SocketProvider = ({ children }) => { const alertIcon = alertData.analysis.alertLevel >= 3 ? '🚨' : alertData.analysis.alertLevel >= 2 ? '⚠️' : '📍'; - const alertColor = alertData.analysis.alertLevel >= 3 ? 'error' : - alertData.analysis.alertLevel >= 2 ? 'warning' : 'info'; - - toast[alertColor === 'error' ? 'error' : alertColor === 'warning' ? 'error' : 'info']( - alertData.analysis.description, - { - duration: alertData.analysis.alertLevel >= 2 ? 10000 : 6000, - icon: alertIcon, - style: { - background: alertData.analysis.alertLevel >= 3 ? '#fee2e2' : - alertData.analysis.alertLevel >= 2 ? '#fef3c7' : '#e0f2fe' - } + const toastOptions = { + duration: alertData.analysis.alertLevel >= 2 ? 10000 : 6000, + icon: alertIcon, + style: { + background: alertData.analysis.alertLevel >= 3 ? '#fee2e2' : + alertData.analysis.alertLevel >= 2 ? '#fef3c7' : '#e0f2fe' } - ); + }; + + if (alertData.analysis.alertLevel >= 3) { + toast.error(alertData.analysis.description, toastOptions); + } else if (alertData.analysis.alertLevel >= 2) { + toast.error(alertData.analysis.description, toastOptions); + } else { + toast(alertData.analysis.description, toastOptions); + } }); // Listen for device heartbeats