Add editMode to poiUtils.js, setupPOIs.js and useMapContextMenu.js

editMode von localStorage lesen und Rechte vergeben oder entnehmen wenn die Schaltfläche "Bearbeitungsmodus aktivieren"
This commit is contained in:
ISA
2024-09-06 11:25:32 +02:00
parent 861c9ead3d
commit af458ac270
3 changed files with 6 additions and 2 deletions

View File

@@ -22,9 +22,9 @@ const determinePriority = (iconPath, priorityConfig) => {
export const createAndSetDevices = async (systemId, setMarkersFunction, GisSystemStatic, priorityConfig) => {
try {
// Zähler für externe API-Aufrufe in localStorage speichern
let requestCount = localStorage.getItem("gisStationsStaticRequestCount") || 0;
let requestCount = localStorage.getItem("gisStationsStaticRequestCount-createDevice") || 0;
requestCount++;
localStorage.setItem("gisStationsStaticRequestCount", requestCount);
localStorage.setItem("gisStationsStaticRequestCount-createDevice", requestCount);
console.log(`config.mapGisStationsStaticDistrictUrl in createAndSetDevice wurde ${requestCount} Mal aufgerufen.`);
const response1 = await fetch(config.mapGisStationsStaticDistrictUrl);

View File

@@ -66,6 +66,8 @@ export const handleEditPoi = (
fetchPoiData,
toast // Hier toast als Parameter erhalten
) => {
const editMode = localStorage.getItem("editMode") === "true";
userRights = editMode ? userRights : undefined;
//console.log("Selected Marker ID (idPoi):", marker.options.id);
//console.log("Selected Marker Description:", marker.options.description);
//console.log("User Rights:", userRights);

View File

@@ -29,6 +29,8 @@ export const setupPOIs = async (
setCurrentPoiData,
deviceName
) => {
const editMode = localStorage.getItem("editMode") === "true";
userRights = editMode ? userRights : undefined;
if (map && poiLayerRef.current) {
map.removeLayer(poiLayerRef.current);
poiLayerRef.current = new L.LayerGroup().addTo(map);