Skip to content

Commit

Permalink
keep all connection logs updated
Browse files Browse the repository at this point in the history
  • Loading branch information
LoV432 committed Nov 13, 2023
1 parent b03a56e commit 2d8b6a6
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<DashboardCardBase backgroundColor={backgroundColor}>
Expand Down

0 comments on commit 2d8b6a6

Please sign in to comment.