Daten von Mock bekommen
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
// /services/api/fetchUserRights.js
|
||||
import * as config from "../../config/config";
|
||||
|
||||
export const fetchUserRights = async () => {
|
||||
let userRightsRequestCount = localStorage.getItem("userRightsRequestCount") || 0;
|
||||
userRightsRequestCount++;
|
||||
localStorage.setItem("userRightsRequestCount", userRightsRequestCount);
|
||||
|
||||
console.log(`fetchUserRights wurde ${userRightsRequestCount} Mal aufgerufen.`);
|
||||
if (config.USE_MOCK_API) {
|
||||
console.log("⚠️ Mock-API: Benutzerrechte geladen");
|
||||
return [56, 57, 58]; // Beispielrechte
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_SERVER_URL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${config.idMap}&idUser=${config.idUser}`, {
|
||||
const response = await fetch(`${config.serverURL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${config.idMap}&idUser=${config.idUser}`, {
|
||||
method: "GET",
|
||||
headers: { Connection: "close" },
|
||||
});
|
||||
@@ -20,7 +20,7 @@ export const fetchUserRights = async () => {
|
||||
|
||||
return data.Rights.map((right) => right.IdRight);
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Abrufen der Benutzerrechte", error);
|
||||
console.error("Fehler beim Abrufen der Benutzerrechte:", error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user