docs: Parameterübergabe in MapComponent dokumentiert
- 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'
This commit is contained in:
@@ -863,7 +863,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const fetchGisStationsStaticDistrict = async (idMap, idUser, dispatch) => {
|
const fetchGisStationsStaticDistrict = async (idMap, idUser, dispatch) => {
|
||||||
try {
|
try {
|
||||||
// API-Endpunkt mit Query-Parametern aufrufen
|
// 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) {
|
if (!response.ok) {
|
||||||
throw new Error("Netzwerkantwort war nicht ok.");
|
throw new Error("Netzwerkantwort war nicht ok.");
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// /config/appVersion
|
// /config/appVersion
|
||||||
export const APP_VERSION = "1.1.67";
|
export const APP_VERSION = "1.1.68";
|
||||||
|
|||||||
60
docs/frontend/components/MapComponent.md
Normal file
60
docs/frontend/components/MapComponent.md
Normal file
@@ -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.
|
||||||
Reference in New Issue
Block a user