setInterval in useLineData um neue Änderungen zu zeichnen
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user