fix: POI Bearbeiten
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
// /utils/poiUtils.js
|
||||
import L from "leaflet";
|
||||
import { toast } from "react-toastify";
|
||||
import circleIcon from "../components/gisPolylines/icons/CircleIcon.js";
|
||||
import { redrawPolyline } from "./polylines/redrawPolyline.js";
|
||||
import circleIcon from "@/components/gisPolylines/icons/CircleIcon.js";
|
||||
import { redrawPolyline } from "@/utils/polylines/redrawPolyline.js";
|
||||
|
||||
import { store } from "../redux/store";
|
||||
import { updatePolylineCoordinatesThunk } from "../redux/thunks/database/polylines/updatePolylineCoordinatesThunk";
|
||||
@@ -67,3 +67,37 @@ export const updateMarkerPosition = (newCoords, lineData, marker) => {
|
||||
if (!marker) return;
|
||||
marker.setLatLng([newCoords.lat, newCoords.lng]);
|
||||
};
|
||||
|
||||
export const handleEditPoi = (
|
||||
marker,
|
||||
userRights,
|
||||
setCurrentPoiData,
|
||||
setShowPoiUpdateModal,
|
||||
fetchPoiData,
|
||||
toast
|
||||
) => {
|
||||
if (!Array.isArray(userRights)) {
|
||||
toast.error("Benutzerrechte sind ungültig.", {
|
||||
position: "top-center",
|
||||
autoClose: 5000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!userRights.some(r => r.IdRight === 56)) {
|
||||
toast.error("Benutzer hat keine Berechtigung zum Bearbeiten.", {
|
||||
position: "top-center",
|
||||
autoClose: 5000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
setCurrentPoiData({
|
||||
idPoi: marker.options.id,
|
||||
name: marker.options.name,
|
||||
description: marker.options.description,
|
||||
});
|
||||
|
||||
fetchPoiData(marker.options.id);
|
||||
setShowPoiUpdateModal(true);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user