fix POI hinzufügen nach 10 Versuche hat immer noch funktioniert!

This commit is contained in:
ISA
2024-07-17 15:47:36 +02:00
parent f07e4b32d2
commit 71b25d9a4d
2 changed files with 15 additions and 15 deletions

View File

@@ -104,9 +104,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
fetchPriorityConfig(); fetchPriorityConfig();
}, []); }, []);
useEffect(() => { /* useEffect(() => {
console.log("Aktualisierte Prioritätskonfiguration:", priorityConfig); console.log("Aktualisierte Prioritätskonfiguration:", priorityConfig);
}, [priorityConfig]); }, [priorityConfig]); */
//--------------------------------------------------------------------- //---------------------------------------------------------------------
useEffect(() => { useEffect(() => {
@@ -143,12 +143,12 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
setMapId(params.get("m")); setMapId(params.get("m"));
setUserId(params.get("u")); setUserId(params.get("u"));
}, [setMapId, setUserId]); }, [setMapId, setUserId]);
useEffect(() => { /* useEffect(() => {
fetchUserRights().then(() => { fetchUserRights().then(() => {
setIsRightsLoaded(true); setIsRightsLoaded(true);
console.log("Benutzerrechte in useEffect in MapComponent:", userRights); console.log("Benutzerrechte in useEffect in MapComponent:", userRights);
}); });
}, [urls.SERVER_URL]); // Lade die Berechtigungen beim Initialisieren der Komponente }, [urls.SERVER_URL]); // Lade die Berechtigungen beim Initialisieren der Komponente */
const [showVersionInfoModal, setShowVersionInfoModal] = useState(false); const [showVersionInfoModal, setShowVersionInfoModal] = useState(false);
const zoomTrigger = useRecoilValue(zoomTriggerState); const zoomTrigger = useRecoilValue(zoomTriggerState);
@@ -369,11 +369,11 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
useEffect(() => { useEffect(() => {
const fetchAndSetUserRights = async () => { const fetchAndSetUserRights = async () => {
const rights = await fetchUserRights(); const rights = await fetchUserRights();
console.log("Benutzerrechte in server URL:", rights); //console.log("Benutzerrechte in server URL:", rights);
setUserRights(rights); setUserRights(rights);
setIsRightsLoaded(true); setIsRightsLoaded(true);
setHasRights(rights && rights.includes(56)); // Prüfen, ob Benutzer die Rechte hat setHasRights(rights && rights.includes(56)); // Prüfen, ob Benutzer die Rechte hat
console.log("Benutzerrechte in useEffect in MapComponent:", rights); //console.log("Benutzerrechte in useEffect in MapComponent:", rights);
}; };
fetchAndSetUserRights(); fetchAndSetUserRights();
@@ -632,7 +632,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
/* useEffect(() => { /* useEffect(() => {
fetchUserRights(); fetchUserRights();
}, []); */ }, []); */
useEffect(() => { /* useEffect(() => {
console.log( console.log(
"Server URL ist verfügbar:", "Server URL ist verfügbar:",
config.url.origin, config.url.origin,
@@ -642,13 +642,13 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
config.idUser config.idUser
); );
fetchUserRights().then((rights) => { fetchUserRights().then((rights) => {
console.log("Benutzerrechte in server URL:", rights); // console.log("Benutzerrechte in server URL:", rights);
setUserRights(rights); setUserRights(rights);
setIsRightsLoaded(true); setIsRightsLoaded(true);
setHasRights(rights && rights.includes(56)); // Prüfen, ob Benutzer die Rechte hat setHasRights(rights && rights.includes(56)); // Prüfen, ob Benutzer die Rechte hat
console.log("Benutzerrechte in useEffect in MapComponent:", hasRights); console.log("Benutzerrechte in useEffect in MapComponent:", hasRights);
}); });
}, []); }, []); */
// Anzeigen von Modals basierend auf Benutzerrechten // Anzeigen von Modals basierend auf Benutzerrechten
useEffect(() => { useEffect(() => {
@@ -2062,7 +2062,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
); );
if (matchingLine) { if (matchingLine) {
colorsByModule[matchingLine.idModul] = stat.PrioColor; colorsByModule[matchingLine.idModul] = stat.PrioColor;
console.log("Übereinstimmung gefunden für: ", stat); //console.log("Übereinstimmung gefunden für: ", stat);
setLinesData(matchingLine); setLinesData(matchingLine);
} }
}); });
@@ -2075,10 +2075,10 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
fetchData(); fetchData();
}, []); }, []);
//--------------------------------------------------------- //---------------------------------------------------------
useEffect(() => { /* useEffect(() => {
console.log("lineStatusData", lineStatusData); console.log("lineStatusData", lineStatusData);
console.log("lineData:", linesData); console.log("lineData:", linesData);
}, [lineStatusData, linesData]); }, [lineStatusData, linesData]); */
//--------------------------------------------------------- //---------------------------------------------------------
const [newPoint, setNewPoint] = useState(null); const [newPoint, setNewPoint] = useState(null);
const [newCoords, setNewCoords] = useState(null); const [newCoords, setNewCoords] = useState(null);

View File

@@ -119,7 +119,7 @@ export const fetchUserRights = async () => {
} }
const data = await response.json(); const data = await response.json();
console.log("Benutzerrechte in fetchRights:", data); // console.log("Benutzerrechte in fetchRights:", data);
// Überprüfen der Struktur der Antwort // Überprüfen der Struktur der Antwort
if (!data || !data.Rights || !Array.isArray(data.Rights)) { if (!data || !data.Rights || !Array.isArray(data.Rights)) {
@@ -127,13 +127,13 @@ export const fetchUserRights = async () => {
} }
const rightsArray = data.Rights; // Nehmen an, dass 'Rights' das Array von Rechten ist const rightsArray = data.Rights; // Nehmen an, dass 'Rights' das Array von Rechten ist
console.log("rightsArray in apiService:", rightsArray); //console.log("rightsArray in apiService:", rightsArray);
// Speichert die IDs der Rechte in einem Array // Speichert die IDs der Rechte in einem Array
const userRightsIds = rightsArray.map((right) => right.IdRight); const userRightsIds = rightsArray.map((right) => right.IdRight);
// Wenn alles gut geht, logge die erfolgreichen Abschluss // Wenn alles gut geht, logge die erfolgreichen Abschluss
console.log("Benutzerrechte erfolgreich abgerufen:", userRightsIds); // console.log("Benutzerrechte erfolgreich abgerufen:", userRightsIds);
return userRightsIds; return userRightsIds;
} catch (error) { } catch (error) {
console.error("Fehler beim Abrufen der Benutzerrechte", error); console.error("Fehler beim Abrufen der Benutzerrechte", error);