docs+refactor: Port-Logik und URL-Handling für Webservices vereinheitlicht
- fetchGisSystemStatic und fetchGisStationsMeasurements nutzen jetzt zentrale .env-Steuerung (NEXT_PUBLIC_API_PORT_MODE) - feste :3000- oder :80-Zugriffe entfernt, dynamisch via hostname aufgebaut - URL-Parameter m/u aus der Query übernommen - zwei neue Dokumentationsdateien im Verzeichnis /docs/frontend/redux/api/fromWebService/ - CHANGELOG.md auf Version 1.1.69 aktualisiert
This commit is contained in:
17
CHANGELOG.md
17
CHANGELOG.md
@@ -4,6 +4,23 @@ Alle bedeutenden Änderungen an diesem Projekt werden in dieser Datei dokumentie
|
||||
|
||||
---
|
||||
|
||||
## [1.1.70] – 2025-05-17
|
||||
|
||||
### Changed
|
||||
|
||||
- `fetchGisSystemStatic.js` umgestellt auf zentrale Port-Logik über `NEXT_PUBLIC_API_PORT_MODE`
|
||||
- `fetchGisStationsMeasurements.js` ebenfalls angepasst mit gleicher URL-/Port-Strategie
|
||||
- Beide Funktionen lesen `idMap` und `idUser` nun direkt aus der URL (`?m=...&u=...`)
|
||||
|
||||
### Added
|
||||
|
||||
- Neue Dokumentation:
|
||||
- `docs/frontend/redux/api/fromWebService/fetchGisSystemStatic.md`
|
||||
- `docs/frontend/redux/api/fromWebService/fetchGisStationsMeasurements.md`
|
||||
- Struktur-/Pfadhinweis jeweils am Ende der Markdown-Dateien ergänzt
|
||||
|
||||
---
|
||||
|
||||
## [1.1.68] – 2025-05-15
|
||||
|
||||
### Changed
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,2 @@
|
||||
// /config/appVersion
|
||||
export const APP_VERSION = "1.1.70";
|
||||
export const APP_VERSION = "1.1.71";
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
# 🌐 fetchGisStationsMeasurements – Geräte-Messwerte abrufen
|
||||
|
||||
## Zweck
|
||||
|
||||
Diese Funktion ruft Messwerte aller Geräte einer Karte ab.
|
||||
Die Daten werden vom Webservice `GisStationsMeasurements` bereitgestellt.
|
||||
|
||||
---
|
||||
|
||||
## Webservice-Endpunkt
|
||||
|
||||
```
|
||||
GisStationsMeasurements?idMap={idMap}&idUser={idUser}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Besonderheit: Port-Steuerung per Umgebungsvariable
|
||||
|
||||
Die Webservices (z. B. `WebServiceMap.asmx`) laufen **immer auf Port 80** –
|
||||
auch in der Entwicklungsumgebung.
|
||||
|
||||
Um das zu berücksichtigen, wird der Port über `.env.local` gesteuert:
|
||||
|
||||
```env
|
||||
NEXT_PUBLIC_API_PORT_MODE=dev
|
||||
```
|
||||
|
||||
### Beispiel (aus dem Code):
|
||||
|
||||
```js
|
||||
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`;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Parameter
|
||||
|
||||
| URL-Parameter | Beschreibung | Übergabe durch TALAS.web |
|
||||
|---------------|--------------|---------------------------|
|
||||
| `m` | Map-ID | Ja |
|
||||
| `u` | User-ID | Ja |
|
||||
|
||||
Diese Parameter werden clientseitig aus der URL gelesen:
|
||||
|
||||
```js
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const idMap = params.get("m");
|
||||
const idUser = params.get("u");
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Beispiel-Aufruf
|
||||
|
||||
```
|
||||
http://10.10.0.13/talas5/MessagesMap/mapTypeC.aspx?m=12&u=484
|
||||
```
|
||||
|
||||
→ ergibt folgenden Webservice-Aufruf:
|
||||
|
||||
```
|
||||
http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsMeasurements?idMap=12&idUser=484
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Siehe auch
|
||||
|
||||
- `.env.local` → `NEXT_PUBLIC_API_PORT_MODE`
|
||||
- `docs/frontend/redux/api/fromWebService/fetchGisSystemStatic.md`
|
||||
- API-Datei: `/redux/api/fromWebService/fetchGisStationsMeasurements.js`
|
||||
|
||||
---
|
||||
|
||||
📄 Pfad: `/docs/frontend/redux/api/fromWebService/fetchGisStationsMeasurements.md`
|
||||
@@ -1,20 +1,23 @@
|
||||
// /redux/api/fromWebService/fetchGisStationsMeasurements.js
|
||||
|
||||
export const fetchGisStationsMeasurements = async () => {
|
||||
const apiBaseUrl = `${window.location.origin}/talas5/ClientData/WebServiceMap.asmx`;
|
||||
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");
|
||||
|
||||
//console.log("🔍 fetchGisStationsMeasurements - URL:", `${apiBaseUrl}/GisStationsMeasurements?idMap=${idMap}&idUser=${idUser}`);
|
||||
const url = `${apiBaseUrl}/GisStationsMeasurements?idMap=${idMap}&idUser=${idUser}`;
|
||||
console.log("🔍 fetchGisStationsMeasurements - URL:", url);
|
||||
|
||||
const response = await fetch(`${apiBaseUrl}/GisStationsMeasurements?idMap=${idMap}&idUser=${idUser}`);
|
||||
const response = await fetch(url);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("GisStationsMeasurements konnte nicht geladen werden");
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
//console.log("✅ fetchGisStationsMeasurements - Daten:", data);
|
||||
return data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user