feat: API-Requests für GIS-Daten korrigiert und Redux-Integration gefixt
- Fehlerhafte Verwendung von `useRouter()` in `fetchGisStationsStaticDistrict.js` behoben
- `idMap` und `idUser` in allen API-Requests über URL-Parameter gesichert
- Alle API-Endpunkte getestet und sichergestellt, dass sie korrekt JSON-Daten liefern
- Debugging-Logs hinzugefügt und Redux-Fehlermeldungen beseitigt
- Jetzt erhalten alle Redux-Stores (`gisStationsStaticDistrict`, `gisStationsStatusDistrict`, `gisStationsMeasurements`, `gisSystemStatic`) erfolgreich die Daten
✅ Alle GIS-Daten werden jetzt korrekt in Redux gespeichert
This commit is contained in:
@@ -48,26 +48,15 @@ export const useMapComponentState = () => {
|
||||
};
|
||||
|
||||
const fetchDeviceData = async () => {
|
||||
if (isMockMode()) {
|
||||
console.log("⚠️ Mock-API: Geräte für POI -> Kontextmenü -> POI bearbeiten -> Dropdown Geräteauswahl geladen (Mock)");
|
||||
|
||||
const mockData = [
|
||||
{ idPoiTyp: 1, name: "Mock Zähleranschlusskasten", icon: 4, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 2, name: "Mock Geräteschrank", icon: 2, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 4, name: "Mock Parkplatz", icon: 3, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 6, name: "Mock Zufahrt", icon: 4, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 20, name: "Mock Zählgerät", icon: 5, onlySystemTyp: 110 },
|
||||
{ idPoiTyp: 21, name: "Mock Messschleife", icon: 6, onlySystemTyp: 110 },
|
||||
{ idPoiTyp: 25, name: "Mock Sonstige", icon: 0, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 33, name: "Mock Autobahnauffahrt", icon: 4, onlySystemTyp: null },
|
||||
];
|
||||
setLocationDeviceData(mockData);
|
||||
setDeviceName(mockData[0].name);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch("/api/talas5/location_device");
|
||||
|
||||
// Sicherstellen, dass die Antwort JSON ist
|
||||
const contentType = response.headers.get("content-type");
|
||||
if (!contentType || !contentType.includes("application/json")) {
|
||||
throw new Error("❌ Ungültige Antwort: Kein JSON erhalten");
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
setLocationDeviceData(data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user