- zentrale API-Port-Logik über .env.local (`NEXT_PUBLIC_API_PORT_MODE`) - URL-Parameter m/u aus der URL extrahiert und übergeben - neue Doku unter /docs/frontend/redux/api/fromWebService/fetchGisStationsStaticDistrict.md - CHANGELOG.md auf Version 1.1.72 erweitert
24 lines
870 B
JavaScript
24 lines
870 B
JavaScript
// /redux/api/fromWebService/fetchGisStationsStaticDistrict.js
|
|
|
|
export const fetchGisStationsStaticDistrict = async () => {
|
|
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 idUser = params.get("u");
|
|
|
|
const url = `${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`;
|
|
console.log("🔍 fetchGisStationsStaticDistrict - URL:", url);
|
|
|
|
const response = await fetch(url);
|
|
|
|
if (!response.ok) {
|
|
throw new Error("GisStationsStaticDistrict konnte nicht geladen werden");
|
|
}
|
|
|
|
const data = await response.json();
|
|
return data;
|
|
};
|