WIP: Add basic structure for edit mode to DataSheet.js

Der Bearbeitungsmodus ist noch nicht vollständig, und es fehlen
einige Funktionalitäten. Reduzierung der Datenbankanfragen noch in Arbeit.
This commit is contained in:
ISA
2024-09-06 10:41:47 +02:00
parent 98e8bdf96e
commit 6850fee16a
8 changed files with 66 additions and 217 deletions

View File

@@ -226,7 +226,8 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const rights = await fetchUserRights();
setUserRights(rights);
setIsRightsLoaded(true);
setHasRights(rights && rights.includes(56)); // Prüfen, ob Benutzer die Rechte hat
setHasRights(localStorage.getItem("editMode") && rights.includes(56)); // Prüfen, ob Benutzer die Rechte hat
};
fetchAndSetUserRights();
@@ -235,8 +236,14 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
useGmaMarkersLayer(map, gmaMarkers, GisStationsMeasurements, layers.MAP_LAYERS.GMA, oms); // Verwende den ausgelagerten Hook
useEffect(() => {
const fetchAllData = async () => {
const fetchWebServiceMap = async () => {
try {
// Zähler für externe API-Aufrufe in localStorage speichern
let requestCount = localStorage.getItem("fetchWebServiceMap") || 0;
requestCount++;
localStorage.setItem("fetchWebServiceMap", requestCount);
console.log(`fetchWebServiceMap in MapComponent wurde ${requestCount} Mal aufgerufen.`);
// Fetch GIS Stations Static District
await fetchGisStationsStaticDistrict(mapGisStationsStaticDistrictUrl, setGisStationsStaticDistrict);
@@ -253,7 +260,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
}
};
fetchAllData();
fetchWebServiceMap();
}, []);
//--------------------------------------------------------
useEffect(() => {