setInterval in useLineData um neue Änderungen zu zeichnen

This commit is contained in:
ISA
2024-09-09 14:50:02 +02:00
parent e94ecd7279
commit f0c61570a0

View File

@@ -1,3 +1,4 @@
// /hooks/useLineData.js
import { useEffect, useState } from "react";
import { SERVER_URL } from "../config/urls";
@@ -153,10 +154,10 @@ const useLineData = (webserviceGisLinesStatusUrl, setLineStatusData) => {
fetchData();
// Setze ein Intervall, um die Daten alle 20 Sekunden erneut abzurufen
//const intervalId = setInterval(fetchData, 20000);
const intervalId = setInterval(fetchData, 20000);
// Räumt das Intervall auf, wenn die Komponente entladen wird
//return () => clearInterval(intervalId);
return () => clearInterval(intervalId);
}, [webserviceGisLinesStatusUrl, setLineStatusData]);
return { lineColors, tooltipContents };