docs+refactor: fetchGisStationsStaticDistrict vereinheitlicht
- 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
This commit is contained in:
16
CHANGELOG.md
16
CHANGELOG.md
@@ -4,6 +4,22 @@ Alle bedeutenden Änderungen an diesem Projekt werden in dieser Datei dokumentie
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## [1.1.72] – 2025-05-17
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- `fetchGisStationsStaticDistrict.js` aktualisiert:
|
||||||
|
- zentrale Steuerung der API-Port-Logik über `.env.local` (`NEXT_PUBLIC_API_PORT_MODE`)
|
||||||
|
- Übergabe von `idMap` und `idUser` über URL-Parameter `?m=...&u=...`
|
||||||
|
- Webservice-Endpunkt dynamisch zusammengesetzt
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Dokumentation erstellt:
|
||||||
|
- `docs/frontend/redux/api/fromWebService/fetchGisStationsStaticDistrict.md`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## [1.1.71] – 2025-05-17
|
## [1.1.71] – 2025-05-17
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// /config/appVersion
|
// /config/appVersion
|
||||||
export const APP_VERSION = "1.1.72";
|
export const APP_VERSION = "1.1.73";
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# 🌐 fetchGisStationsStaticDistrict – Statische Gerätebezirksdaten abrufen
|
||||||
|
|
||||||
|
## Zweck
|
||||||
|
|
||||||
|
Diese Funktion ruft alle statischen Geräte- und Sektordaten eines bestimmten Kartenbereichs ab.
|
||||||
|
Sie basiert auf dem Webservice-Endpunkt `GisStationsStaticDistrict`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Webservice-Endpunkt
|
||||||
|
|
||||||
|
```
|
||||||
|
GisStationsStaticDistrict?idMap={idMap}&idUser={idUser}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Portsteuerung über Umgebungsvariable
|
||||||
|
|
||||||
|
Da die Webservices in allen Umgebungen auf Port 80 laufen, wird der Zugriff über eine Umgebungsvariable gesteuert:
|
||||||
|
|
||||||
|
```env
|
||||||
|
NEXT_PUBLIC_API_PORT_MODE=dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Codebeispiel:
|
||||||
|
|
||||||
|
```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`;
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## URL-Parameter
|
||||||
|
|
||||||
|
| Parameter | Beschreibung | Wird übergeben durch |
|
||||||
|
|-----------|--------------|------------------------|
|
||||||
|
| `m` | Map-ID | TALAS.web (in URL) |
|
||||||
|
| `u` | User-ID | TALAS.web (in URL) |
|
||||||
|
|
||||||
|
```js
|
||||||
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
const idMap = params.get("m");
|
||||||
|
const idUser = params.get("u");
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Beispiel
|
||||||
|
|
||||||
|
```
|
||||||
|
http://10.10.0.13/talas5/MessagesMap/mapTypeC.aspx?m=12&u=484
|
||||||
|
```
|
||||||
|
|
||||||
|
→ wird übersetzt zu:
|
||||||
|
|
||||||
|
```
|
||||||
|
http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsStaticDistrict?idMap=12&idUser=484
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Siehe auch
|
||||||
|
|
||||||
|
- `.env.local` → `NEXT_PUBLIC_API_PORT_MODE`
|
||||||
|
- `fetchGisStationsStatic.js`
|
||||||
|
- `fetchGisStationsMeasurements.js`
|
||||||
|
- `fetchGisSystemStatic.js`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
📄 Pfad: `/docs/frontend/redux/api/fromWebService/fetchGisStationsStaticDistrict.md`
|
||||||
@@ -1,20 +1,23 @@
|
|||||||
// /redux/api/fromWebService/fetchGisStationsStaticDistrict.js
|
// /redux/api/fromWebService/fetchGisStationsStaticDistrict.js
|
||||||
|
|
||||||
export const fetchGisStationsStaticDistrict = async () => {
|
export const fetchGisStationsStaticDistrict = 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 params = new URLSearchParams(window.location.search);
|
||||||
const idMap = params.get("m");
|
const idMap = params.get("m");
|
||||||
const idUser = params.get("u");
|
const idUser = params.get("u");
|
||||||
|
|
||||||
console.log("🔍 fetchGisStationsStaticDistrict - URL:", `${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`);
|
const url = `${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`;
|
||||||
|
console.log("🔍 fetchGisStationsStaticDistrict - URL:", url);
|
||||||
|
|
||||||
const response = await fetch(`${apiBaseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`);
|
const response = await fetch(url);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("GisStationsStaticDistrict konnte nicht geladen werden");
|
throw new Error("GisStationsStaticDistrict konnte nicht geladen werden");
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
// console.log("✅ fetchGisStationsStaticDistrict - Daten:", data);
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user