From 06028ccb6fa49ff045e6fe458b0906052c8f5b43 Mon Sep 17 00:00:00 2001 From: ISA Date: Fri, 16 May 2025 06:51:54 +0200 Subject: [PATCH] =?UTF-8?q?docs:=20Parameter=C3=BCbergabe=20in=20MapCompon?= =?UTF-8?q?ent=20dokumentiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Neue Datei `docs/frontend/components/MapComponent.md` hinzugefügt - Erklärung zur Verwendung von ?m=...&u=... im Frontend - Klarstellung, dass Webservices idMap/idUser erwarten - MapComponent angepasst für URL-Parameter 'm' und 'u' --- components/mainComponent/MapComponent.js | 2 +- config/appVersion.js | 2 +- docs/frontend/components/MapComponent.md | 60 ++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 docs/frontend/components/MapComponent.md diff --git a/components/mainComponent/MapComponent.js b/components/mainComponent/MapComponent.js index 936760503..7a7d22447 100644 --- a/components/mainComponent/MapComponent.js +++ b/components/mainComponent/MapComponent.js @@ -863,7 +863,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { const fetchGisStationsStaticDistrict = async (idMap, idUser, dispatch) => { try { // API-Endpunkt mit Query-Parametern aufrufen - const response = await fetch(`/api/gisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`); + const response = await fetch(`/api/gisStationsStaticDistrict?m=${idMap}&u=${idUser}`); if (!response.ok) { throw new Error("Netzwerkantwort war nicht ok."); diff --git a/config/appVersion.js b/config/appVersion.js index 99dcbb3b1..179ee6e01 100644 --- a/config/appVersion.js +++ b/config/appVersion.js @@ -1,2 +1,2 @@ // /config/appVersion -export const APP_VERSION = "1.1.67"; +export const APP_VERSION = "1.1.68"; diff --git a/docs/frontend/components/MapComponent.md b/docs/frontend/components/MapComponent.md new file mode 100644 index 000000000..3d4db7144 --- /dev/null +++ b/docs/frontend/components/MapComponent.md @@ -0,0 +1,60 @@ +# 🗺️ MapComponent – Webservice-Parameter + +## 🔄 URL-Parameter vom Aufrufer (z. B. TALAS.web) + +Die Anwendung wird mit Kurzparametern aufgerufen: + +``` +http://[SERVER]:3000/?m=12&u=484 +``` + +| Parameter | Bedeutung | +| --------- | -------------------------- | +| `m` | Map-ID (intern: `idMap`) | +| `u` | User-ID (intern: `idUser`) | + +Diese Parameter werden im Code wie folgt gelesen: + +```js +const params = new URLSearchParams(window.location.search); +const idMap = params.get("m"); +const idUser = params.get("u"); +``` + +--- + +## 🔁 Webservice-Proxy intern + +Die Next.js API-Routen übernehmen die Umwandlung zu den Webservices: + +```js +// Beispiel: /pages/api/gisSystemStatic.js +const targetUrl = `http://.../WebServiceMap.asmx/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`; +``` + +➡ Die Konvertierung `m → idMap` und `u → idUser` erfolgt **nur im Backend (API-Routen)** + +--- + +## 🧠 Hinweis für Entwickler + +- `m` und `u` **immer** aus der URL im Client lesen +- Niemals `idMap` oder `idUser` direkt im Frontend erwarten +- Alle Webservice-Zugriffe im Frontend laufen über interne API-Routen `/api/...` +- Beispiel-Aufruf: + ```js + fetch(`/api/gisSystemStatic?m=${idMap}&u=${idUser}`); + ``` + +--- + +## 🌐 Beispiele aus der Praxis + +| Umgebung | URL-Aufruf-Beispiel | +| --------------------- | ------------------------------------------------------------- | +| Entwicklungs-PC | http://10.10.0.70:3000/?m=12&u=484 | +| Test-Server via TALAS | http://10.10.0.13/talas5/MessagesMap/mapTypeC.aspx?m=12&u=484 | + +--- + +Diese Konvention ist essenziell für einheitliche Übergabe und Backend-Kompatibilität.