Files
nodeMap/docs/frontend/services/api/fetchGisStatusStations.md
Ismail Ali e01c6f9324 refactor+docs: fetchGisStatusStations.js URL-Handling vereinheitlicht (v1.1.78)
- entfernt: NEXT_PUBLIC_SERVER_URL aus fetchGisStatusStations.js
- ersetzt durch dynamischen URL-Aufbau via NEXT_PUBLIC_API_PORT_MODE
- neue Doku erstellt: docs/frontend/services/api/fetchGisStatusStations.md
- CHANGELOG.md aktualisiert (v1.1.78)
2025-05-17 01:17:59 +02:00

84 lines
1.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 🛰️ fetchGisStatusStations Geräte-Statusdaten abrufen
## Zweck
Diese Funktion ruft den aktuellen Status aller Stationen (Geräte) für eine bestimmte Karte ab.
Sie basiert auf dem Webservice `GisStationsStatusDistrict`.
---
## Webservice-Endpunkt
```
GET /talas5/ClientData/WebServiceMap.asmx/GisStationsStatusDistrict?idMap={idMap}&idUser={idUser}
```
---
## Dynamische URL-Erzeugung
Die Funktion nutzt **keine feste URL** aus `.env.local`, sondern erkennt die Umgebung anhand von:
```env
NEXT_PUBLIC_API_PORT_MODE=dev
```
### Beispiel aus dem Code:
```js
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
const SERVER_URL =
mode === "dev"
? \`\${window.location.protocol}//\${window.location.hostname}:80\`
: \`\${window.location.origin}\`;
```
---
## Parameter
| Name | Typ | Beschreibung |
|----------|--------|--------------------------|
| `idMap` | string | Karten-ID |
| `idUser` | string | Benutzer-ID |
---
## Verwendung
Die Funktion nutzt `fetchWithTimeout` mit einem Timeout von 5000ms.
```js
fetchWithTimeout(
\`\${SERVER_URL}/talas5/ClientData/WebServiceMap.asmx/GisStationsStatusDistrict?idMap=\${idMap}&idUser=\${idUser}\`,
{ method: "GET", headers: { Connection: "close" } },
5000
)
```
---
## Fehlerbehandlung
Bei HTTP-Fehlern oder Zeitüberschreitung wird ein Fehler geloggt und erneut geworfen.
```js
if (!response.ok) throw new Error(...);
.catch((error) => {
console.error(...);
throw error;
});
```
---
## Siehe auch
- `.env.local``NEXT_PUBLIC_API_PORT_MODE`
- `fetchWithTimeout.js`
- `GisStationsStaticDistrict`, `GisSystemStatic`
---
📄 Pfad: `/docs/frontend/services/api/fetchGisStatusStations.md`