docs: Projektstruktur der Dokumentation an Quellcode angepasst

- Verzeichnisstruktur unter /docs spiegelt nun die tatsächliche Projektstruktur wider
- frontend/server-Trennung entfernt zugunsten von /docs/pages, /docs/redux, /docs/utils etc.
- Erhöht Wiederauffindbarkeit, Übersichtlichkeit und Entwicklerfreundlichkeit
This commit is contained in:
ISA
2025-05-27 09:30:40 +02:00
parent 4c6386edea
commit b847b5d2c8
55 changed files with 29 additions and 3 deletions

View File

@@ -0,0 +1,70 @@
# 🌐 fetchLocationDevices
Diese Funktion lädt alle Geräte für einen bestimmten Standort aus der Datenbank via API-Endpunkt.
---
## 📍 Pfad
```
/redux/api/fromDB/fetchLocationDevices.js
```
---
## 📥 Funktion
```ts
export const fetchLocationDevices = async () => {
const response = await fetch("/api/talas_v5_DB/locationDevice/locationDevices");
if (!response.ok) {
throw new Error("Geräteliste konnte nicht geladen werden");
}
return await response.json();
};
```
---
## 📡 API-Endpunkt
```http
GET /api/talas_v5_DB/locationDevice/locationDevices
```
Dieser Endpunkt liefert eine JSON-Liste aller Geräte eines Standorts (z.B. für Map-Rendering, POI-Anzeige, Standortübersicht etc.).
---
## 🧪 Fehlerbehandlung
Falls der Request fehlschlägt (z.B. Statuscode ≠ 2xx), wird folgender Fehler ausgelöst:
```
"Geräteliste konnte nicht geladen werden"
```
Dies kann im Redux-Slice über den `.rejected`-Case ausgewertet werden.
---
## 🧩 Verwendung
```ts
import { fetchLocationDevices } from "@/redux/api/fromDB/fetchLocationDevices";
const result = await fetchLocationDevices();
console.log(result); // Erwartet: Array von Geräteobjekten
```
Diese Funktion wird typischerweise im Redux-Thunk `fetchLocationDevicesFromDB` verwendet:
```ts
const data = await fetchLocationDevices();
```
---
## 🔄 Zusammenhang
- Eingebunden in: [`locationDevicesFromDBSlice.js`](./locationDevicesFromDBSlice.md)
- Redux Thunk: `fetchLocationDevicesFromDB`