refactor: POI aktualisieren auf updatePoiThunk + ID aus react-select umgestellt

- Thunk getDeviceIdByNameThunk entfernt
- idLD direkt aus Dropdown gelesen
- updatePoiThunk + updatePoiService vollständig eingebunden
- Fehlerbehandlung in handleSubmit verbessert
- Version erhöht auf 1.1.162
This commit is contained in:
Ismail Ali
2025-05-24 09:18:34 +02:00
parent b69a3efae3
commit fc6a706769
7 changed files with 98 additions and 24 deletions

View File

@@ -0,0 +1,10 @@
// /services/database/getDeviceIdByNameService.js
export const getDeviceIdByNameService = async (deviceName) => {
const response = await fetch(`/api/talas_v5_DB/locationDevice/getDeviceId?deviceName=${encodeURIComponent(deviceName)}`);
if (!response.ok) {
throw new Error("Fehler beim Abrufen der Geräte-ID.");
}
const data = await response.json();
return data.idLD;
};

View File

@@ -0,0 +1,16 @@
// /services/database/updatePoiService.js
export const updatePoiService = async (poi) => {
const response = await fetch("/api/talas_v5_DB/pois/updatePoi", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(poi),
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error || "Fehler beim Aktualisieren des POI.");
}
};