// /redux/api/fromWebService/fetchGisStationsStatic.js export const fetchGisStationsStatic = async () => { try { const mode = process.env.NEXT_PUBLIC_API_PORT_MODE; const apiBaseUrl = mode === "dev" ? `${window.location.protocol}//${window.location.hostname}:80/talas5/ClientData/WebServiceMap.asmx` : `${window.location.origin}/talas5/ClientData/WebServiceMap.asmx`; const params = new URLSearchParams(window.location.search); const idMap = params.get("m"); const url = `${apiBaseUrl}/GisStationsStatic?idMap=${idMap}`; console.log("🔍 fetchGisStationsStatic - URL:", url); const response = await fetch(url); const text = await response.text(); console.log("📡 API Response Text von fetch:", text); if (!response.ok || !response.headers.get("content-type")?.includes("application/json")) { throw new Error("❌ Fehler: Antwort ist kein gültiges JSON"); } return JSON.parse(text); } catch (error) { console.error("❌ Fehler beim Abrufen der GIS Stations Static:", error); return null; } };