// /services/webservice/fetchUserRightsService.js export const fetchUserRightsService = async () => { const mode = process.env.NEXT_PUBLIC_API_PORT_MODE; const apiBaseUrl = mode === "dev" ? `${window.location.protocol}//${window.location.hostname}:80/talas5/ClientData/WebServiceMap.asmx` : `${window.location.origin}/talas5/ClientData/WebServiceMap.asmx`; const params = new URLSearchParams(window.location.search); const idMap = params.get("m"); const idUser = params.get("u"); const url = `${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`; console.log("🔍 Rechte-Fetch URL:", url); const response = await fetch(url, { method: "GET", headers: { Connection: "close", }, }); if (!response.ok) { throw new Error("Fehler beim Abrufen der Benutzerrechte"); } const json = await response.json(); console.log("👤 Rechte-Response JSON:", json); return json.Rights || []; };