diff --git a/app/components/dashboard/DashboardCardTotalDisconnectTime.client.tsx b/app/components/dashboard/DashboardCardTotalDisconnectTime.client.tsx index 84ff5e3..37baa9b 100644 --- a/app/components/dashboard/DashboardCardTotalDisconnectTime.client.tsx +++ b/app/components/dashboard/DashboardCardTotalDisconnectTime.client.tsx @@ -25,6 +25,21 @@ export default function DashboardCardTotalDisconnectTime({ connectionLogsListModalRef.current?.showModal(); } } + + useEffect(() => { + const interval = setInterval(() => { + const getNewLogs = fetch('/api/get-connection-logs'); + getNewLogs + .then((response) => response.json()) + .then((data: connectionLogsList) => { + setHumanReadableDisconnectedTime( + connectionLogsListToHumanFormat(data) + ); + setBackgroundColor(dashboardColor(humanReadableDisconnectedTime)); + }); + }, 3000); + return () => clearInterval(interval); + }, []); return ( <>