- Geräte-Liste wird jetzt direkt aus dem Redux-Store (locationDevicesFromDB) verwendet. - Dropdown-Menü zeigt alle verfügbaren Geräte aus der Datenbank. - Beim Öffnen des Modals wird der vorher zugewiesene Gerätname automatisch ausgewählt (Pre-Selection). - Cleanup und Optimierung: Keine separaten API-Calls mehr im Modal. - Struktur verbessert durch Auslagerung der Lade-Logik in useInitLocationDevices Hook.
9 lines
305 B
JavaScript
9 lines
305 B
JavaScript
// /redux/api/fromDB/locationDevicesLoader.js
|
|
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();
|
|
};
|