Poi update, aber idLD muss noch gemacht werden
This commit is contained in:
@@ -68,8 +68,33 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
||||
|
||||
// Form submission handler
|
||||
const handleSubmit = async (event) => {
|
||||
event.preventDefault(); // Prevent the form from submitting
|
||||
// Perform update operation here
|
||||
event.preventDefault();
|
||||
try {
|
||||
const response = await fetch("/api/updatePoi", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
idPoi: poiId,
|
||||
description: name,
|
||||
idPoiTyp: poiTypeId,
|
||||
}),
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
alert("POI wurde erfolgreich aktualisiert.");
|
||||
onClose(); // Schließen des Modals und Aktualisieren der Ansicht
|
||||
} else {
|
||||
const errorResponse = await response.json();
|
||||
throw new Error(
|
||||
errorResponse.error || "Fehler beim Aktualisieren des POI."
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Aktualisieren des POI:", error);
|
||||
alert("Fehler beim Aktualisieren des POI.");
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user