diff --git a/components/pois/PoiUpdateModal.js b/components/pois/PoiUpdateModal.js index 4fa4247b9..70b60d166 100644 --- a/components/pois/PoiUpdateModal.js +++ b/components/pois/PoiUpdateModal.js @@ -80,6 +80,25 @@ const PoiUpdateModal = ({ onClose, poiData, onSubmit }) => { fetchLocationDevices(); }, [poiData]); + const handleDeletePoi = async () => { + if (confirm("Sind Sie sicher, dass Sie diesen POI löschen möchten?")) { + try { + const response = await fetch(`/api/talas_v5_DB/pois/deletePoi?id=${poiId}`, { + method: "DELETE", + }); + if (response.ok) { + onClose(); + window.location.reload(); + } else { + throw new Error("Fehler beim Löschen des POI."); + } + } catch (error) { + console.error("Fehler beim Löschen des POI:", error); + alert("Fehler beim Löschen des POI."); + } + } + }; + const handleSubmit = async (event) => { event.preventDefault(); const idLDResponse = await fetch(`/api/talas_v5_DB/locationDevice/getDeviceId?deviceName=${encodeURIComponent(deviceName)}`); @@ -155,7 +174,9 @@ const PoiUpdateModal = ({ onClose, poiData, onSubmit }) => { ))} - +