add: install and implement react-toastify for permission

This commit is contained in:
ISA
2024-05-28 13:21:00 +02:00
parent 21218609bc
commit ec302cfee2
3 changed files with 34 additions and 0 deletions

View File

@@ -23,6 +23,8 @@ import { InformationCircleIcon } from "@heroicons/react/20/solid"; // oder 'outl
import PoiUpdateModal from "./PoiUpdateModal.js";
import { selectedPoiState } from "../store/atoms/poiState.js";
import { currentPoiState } from "../store/atoms/currentPoiState";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
//import { createRoot } from "react-dom/client";
@@ -52,6 +54,15 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
const handleEditPoi = (marker) => {
// Prüfung, ob der Benutzer die notwendigen Rechte hat
if (!userRights || !userRights.includes(56)) {
toast.error("Benutzer hat keine Berechtigung zum Bearbeiten.", {
position: "top-center",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
});
console.log("Benutzer hat keine Berechtigung zum Bearbeiten.");
return; // Beendet die Funktion frühzeitig, wenn keine Berechtigung vorliegt
}
@@ -1814,6 +1825,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
return (
<>
<ToastContainer />
<div>
{/* Zeigt das Popup-Fenster nur, wenn `showPopup` wahr ist */}
{showPoiUpdateModal && (