diff --git a/components/PoiUpdateModal.js b/components/PoiUpdateModal.js index 71df3181a..a4a66d0be 100644 --- a/components/PoiUpdateModal.js +++ b/components/PoiUpdateModal.js @@ -1,4 +1,4 @@ -// pages/api/poiUpdateModal.js +// pages/api/poiUpdateModal.js // import React, { useState, useEffect } from "react"; @@ -42,8 +42,6 @@ const PoiUpdateModal = ({ onClose, poiData }) => { } }; - - // Beim Öffnen des Modals die Geräte-ID basierend auf dem Gerätenamen abrufen, wenn vorhanden useEffect(() => { const fetchDeviceId = async () => { @@ -112,8 +110,10 @@ const PoiUpdateModal = ({ onClose, poiData }) => { //console.log("Standort- und Gerätedaten:", data); setLocationDeviceData(data); if (poiData && poiData.idLD) { - const selectedDevice = data.find(device => device.id === poiData.idLD); - setDeviceName(selectedDevice ? selectedDevice.id : data[0].id); // Hier wird die ID als initialer Zustand gesetzt + const selectedDevice = data.find( + (device) => device.id === poiData.idLD + ); + setDeviceName(selectedDevice ? selectedDevice.id : data[0].id); // Hier wird die ID als initialer Zustand gesetzt } } catch (error) { console.error( @@ -146,7 +146,7 @@ const PoiUpdateModal = ({ onClose, poiData }) => { name: name, description: description, idPoiTyp: poiTypeId, - idLD: deviceName, + idLD: idLD, //idLD: parseInt(deviceName, 10), // Konvertieren in eine Ganzzahl }), }); @@ -166,11 +166,6 @@ const PoiUpdateModal = ({ onClose, poiData }) => { } }; - - - - - return (