- alle festen "/talas5/" Pfade entfernt - dynamischer basePath für API-Links und Station öffnen - README.md und CHANGELOG.md aktualisiert - Version erhöht auf 1.1.188
29 lines
1003 B
JavaScript
29 lines
1003 B
JavaScript
// /services/webservice/fetchUserRightsService.js
|
|
export const fetchUserRightsService = async () => {
|
|
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
|
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "";
|
|
const baseUrl = mode === "dev" ? `${window.location.protocol}//${window.location.hostname}:80${basePath}/ClientData/WebServiceMap.asmx` : `${window.location.origin}${basePath}/ClientData/WebServiceMap.asmx`;
|
|
|
|
const params = new URLSearchParams(window.location.search);
|
|
const idMap = params.get("m");
|
|
const idUser = params.get("u");
|
|
|
|
const url = `${baseUrl}/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 || [];
|
|
};
|