refactor: entferne veralteten fetch-Block für gisLinesStatus aus MapComponent

- fetch(...) durch Redux-Thunk ersetzt
- Daten werden zentral über fetchLineStatusAndLinesThunk bereitgestellt
- keine Redundanz oder Datenverluste festgestellt
This commit is contained in:
ISA
2025-05-21 14:59:05 +02:00
parent 6885768bed
commit 2f4c264b4b
2 changed files with 1 additions and 35 deletions

View File

@@ -362,40 +362,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
}
}, [poiTypStatus, dispatch]);
//--------------------------------------------
useEffect(() => {
const fetchData = async () => {
try {
const response1 = await fetch(webserviceGisLinesStatusUrl);
const data1 = await response1.json();
//console.log("data1.Statis", data1.Statis);
const reversedData = data1.Statis.reverse();
setLineStatusData(reversedData);
const response2 = await fetch("/api/talas_v5_DB/gisLines/readGisLines");
const data2 = await response2.json();
const colorsByModule = {};
reversedData.forEach((stat) => {
if (!Array.isArray(data2)) {
console.warn("WARNUNG: gis_lines ist kein Array, wird ignoriert.");
return;
}
const matchingLine = data2.find((item) => item.idLD === stat.IdLD && item.idModul === stat.Modul);
if (matchingLine) {
colorsByModule[matchingLine.idModul] = stat.PrioColor;
//console.log("Übereinstimmung gefunden für: ", stat);
setLinesData(matchingLine);
}
});
//setLineColors(colorsByModule);
} catch (error) {
console.error("Error fetching data:", error);
}
};
fetchData();
}, []);
//-----------------------------------------------------------------
//Tooltip an mouse position anzeigen für die Linien
useEffect(() => {