idLD update done! muss noch Gerät und Typ gelesen von POI ins dropdown menu
This commit is contained in:
@@ -41,6 +41,8 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Beim Öffnen des Modals die Geräte-ID basierend auf dem Gerätenamen abrufen, wenn vorhanden
|
// Beim Öffnen des Modals die Geräte-ID basierend auf dem Gerätenamen abrufen, wenn vorhanden
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchDeviceId = async () => {
|
const fetchDeviceId = async () => {
|
||||||
@@ -126,6 +128,11 @@ const idLD = deviceName; // Stellen Sie sicher, dass dies eine ID ist und kein N
|
|||||||
|
|
||||||
const handleSubmit = async (event) => {
|
const handleSubmit = async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
const idLDResponse = await fetch(
|
||||||
|
`/api/getDeviceId?deviceName=${encodeURIComponent(deviceName)}`
|
||||||
|
);
|
||||||
|
const idLDData = await idLDResponse.json();
|
||||||
|
const idLD = idLDData.idLD;
|
||||||
try {
|
try {
|
||||||
const response = await fetch("/api/updatePoi", {
|
const response = await fetch("/api/updatePoi", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -137,7 +144,8 @@ const handleSubmit = async (event) => {
|
|||||||
name: name,
|
name: name,
|
||||||
description: description,
|
description: description,
|
||||||
idPoiTyp: poiTypeId,
|
idPoiTyp: poiTypeId,
|
||||||
idLD: parseInt(deviceName, 10), // Konvertieren in eine Ganzzahl
|
idLD: idLD,
|
||||||
|
//idLD: parseInt(deviceName, 10), // Konvertieren in eine Ganzzahl
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -190,14 +198,11 @@ const handleSubmit = async (event) => {
|
|||||||
className="block p-2 w-full border-2 border-gray-200 rounded-md text-sm"
|
className="block p-2 w-full border-2 border-gray-200 rounded-md text-sm"
|
||||||
>
|
>
|
||||||
{locationDeviceData.map((device, index) => (
|
{locationDeviceData.map((device, index) => (
|
||||||
<option key={index} value={device.id}> {/* Stellen Sie sicher, dass device.id eine Ganzzahl ist */}
|
<option key={index} value={device.name}>
|
||||||
{device.name}
|
{device.name}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center mb-4">
|
<div className="flex items-center mb-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user