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:
@@ -9,7 +9,7 @@ DB_PORT=3306
|
|||||||
# Public Settings (Client braucht IP/Domain)
|
# Public Settings (Client braucht IP/Domain)
|
||||||
NEXT_PUBLIC_SERVER_URL="http://192.168.10.33" # oder evtl. später https://nodemap.firma.de
|
NEXT_PUBLIC_SERVER_URL="http://192.168.10.33" # oder evtl. später https://nodemap.firma.de
|
||||||
NEXT_PUBLIC_ENABLE_GEOCODER=true
|
NEXT_PUBLIC_ENABLE_GEOCODER=true
|
||||||
NEXT_PUBLIC_USE_MOCK_API=false
|
NEXT_PUBLIC_USE_MOCK_API=true
|
||||||
NEXT_PUBLIC_DEBUG_LOG=true
|
NEXT_PUBLIC_DEBUG_LOG=true
|
||||||
|
|
||||||
# für Polylines/kabelstecken -> in Konextmenü "Station öffnen" "
|
# für Polylines/kabelstecken -> in Konextmenü "Station öffnen" "
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// /config/appVersion
|
// /config/appVersion
|
||||||
export const APP_VERSION = "1.1.27";
|
export const APP_VERSION = "1.1.28";
|
||||||
|
|||||||
@@ -48,26 +48,15 @@ export const useMapComponentState = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fetchDeviceData = async () => {
|
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 {
|
try {
|
||||||
const response = await fetch("/api/talas5/location_device");
|
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();
|
const data = await response.json();
|
||||||
setLocationDeviceData(data);
|
setLocationDeviceData(data);
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
// /redux/api/fromWebService/fetchGisStationsMeasurements.js
|
// /redux/api/fromWebService/fetchGisStationsMeasurements.js
|
||||||
|
// http://192.168.10.33/talas5/ClientData/WebServiceMap.asmx/GisStationsMeasurements?idMap=12&idUser=484
|
||||||
|
|
||||||
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
||||||
|
|
||||||
export const fetchGisStationsMeasurements = async () => {
|
export const fetchGisStationsMeasurements = async () => {
|
||||||
const response = await fetch(`${apiBaseUrl}/GisStationsMeasurements`);
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
||||||
|
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
||||||
|
|
||||||
|
console.log("🔍 fetchGisStationsMeasurements - URL:", `${apiBaseUrl}/GisStationsMeasurements?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
|
const response = await fetch(`${apiBaseUrl}/GisStationsMeasurements?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("GisStationsMeasurements konnte nicht geladen werden");
|
throw new Error("GisStationsMeasurements konnte nicht geladen werden");
|
||||||
}
|
}
|
||||||
return await response.json();
|
|
||||||
|
const data = await response.json();
|
||||||
|
console.log("✅ fetchGisStationsMeasurements - Daten:", data);
|
||||||
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
// /redux/api/fromWebService/fetchGisStationsStaticDistrict.js
|
// /redux/api/fromWebService/fetchGisStationsStaticDistrict.js
|
||||||
|
// http://192.168.10.33/talas5/ClientData/WebServiceMap.asmx/GisStationsStaticDistrict?idMap=12&idUser=484
|
||||||
|
|
||||||
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
||||||
|
|
||||||
export const fetchGisStationsStaticDistrict = async () => {
|
export const fetchGisStationsStaticDistrict = async () => {
|
||||||
const response = await fetch(`${apiBaseUrl}/GisStationsStaticDistrict`);
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
||||||
|
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
||||||
|
|
||||||
|
console.log("🔍 fetchGisStationsStaticDistrict - URL:", `${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
|
const response = await fetch(`${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("GisStationsStaticDistrict konnte nicht geladen werden");
|
throw new Error("GisStationsStaticDistrict konnte nicht geladen werden");
|
||||||
}
|
}
|
||||||
return await response.json();
|
|
||||||
|
const data = await response.json();
|
||||||
|
console.log("✅ fetchGisStationsStaticDistrict - Daten:", data);
|
||||||
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
// /redux/api/fromWebService/fetchGisStationsStatusDistrict.js
|
// /redux/api/fromWebService/fetchGisStationsStatusDistrict.js
|
||||||
|
// http://192.168.10.33/talas5/ClientData/WebServiceMap.asmx/GisStationsStatusDistrict?idMap=12&idUser=484
|
||||||
|
|
||||||
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
||||||
|
|
||||||
export const fetchGisStationsStatusDistrict = async () => {
|
export const fetchGisStationsStatusDistrict = async () => {
|
||||||
const response = await fetch(`${apiBaseUrl}/GisStationsStatusDistrict`);
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
||||||
|
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
||||||
|
|
||||||
|
console.log("🔍 fetchGisStationsStatusDistrict - URL:", `${apiBaseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
|
const response = await fetch(`${apiBaseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("GisStationsStatusDistrict konnte nicht geladen werden");
|
throw new Error("GisStationsStatusDistrict konnte nicht geladen werden");
|
||||||
}
|
}
|
||||||
return await response.json();
|
|
||||||
|
const data = await response.json();
|
||||||
|
console.log("✅ fetchGisStationsStatusDistrict - Daten:", data);
|
||||||
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// /redux/api/fromWebService/fetchGisSystemStatic.js
|
// /redux/api/fromWebService/fetchGisSystemStatic.js
|
||||||
|
// http://192.168.10.33/talas5/ClientData/WebServiceMap.asmx/GisSystemStatic?idMap=12&idUser=484
|
||||||
|
|
||||||
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
||||||
|
|
||||||
export async function fetchGisSystemStatic() {
|
export async function fetchGisSystemStatic() {
|
||||||
@@ -6,9 +8,11 @@ export async function fetchGisSystemStatic() {
|
|||||||
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
const idMap = params.get("idMap") || process.env.NEXT_PUBLIC_DEFAULT_ID_MAP || "12";
|
||||||
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
const idUser = params.get("idUser") || process.env.NEXT_PUBLIC_DEFAULT_ID_USER || "484";
|
||||||
|
|
||||||
|
console.log("🔍 fetchGisSystemStatic - URL:", `${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`);
|
||||||
|
|
||||||
const response = await fetch(`${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`);
|
const response = await fetch(`${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
console.log("fetchGisSystemStatic API Response:", data);
|
console.log("✅ fetchGisSystemStatic - Daten:", data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user