add: install and implement react-toastify for permission
This commit is contained in:
@@ -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 && (
|
||||
|
||||
Reference in New Issue
Block a user