fix: POIs können per Drag und Drop verschoben werden auf die Map
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
// services/apiService.js
|
||||
import * as config from "../config/config";
|
||||
import { setPriorityConfig } from "../utils/utils";
|
||||
import * as urls from "../config/urls";
|
||||
|
||||
export const fetchGisStatusStations = async (idMap, idUser) => {
|
||||
try {
|
||||
@@ -81,31 +84,6 @@ export const checkInternet = () => {
|
||||
.catch(() => setOnline(false));
|
||||
};
|
||||
|
||||
// ----------------------------------------------
|
||||
export const fetchUserRights = async (serverURL) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${c}&idUser=${user}`
|
||||
//`${serverURL}/api/talas5/webserviceMap/GisSystemStatic?idMap=${c}&idUser=${user}` //Berechtigung zum hinzufügen von POIs in der Karte
|
||||
//`${serverURL}/api/rights?idMap=${c}&idUser=${user}`
|
||||
);
|
||||
const data = await response.json();
|
||||
//console.log("Benutzerrechte:", data);
|
||||
const rightsArray = data.Rights; // Nehmen an, dass 'Rights' das Array von Rechten ist
|
||||
|
||||
// Speichert die IDs der Rechte in einem Array
|
||||
const userRightsIds = rightsArray.map((right) => right.IdRight);
|
||||
setUserRights(userRightsIds); // Speichert die Rechte in den Zustand
|
||||
|
||||
//console.log("Benutzerrechte:", rightsArray);
|
||||
//console.log("Benutzerrechte IDs:", userRightsIds);
|
||||
//console.log("Benutzerrechte in if :", userRightsIds.includes(56));
|
||||
setHasRights(userRightsIds.includes(56));
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Abrufen der Benutzerrechte", error);
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------
|
||||
export const fetchDeviceNameById = async (idLD) => {
|
||||
try {
|
||||
@@ -126,3 +104,38 @@ export const fetchDeviceNameById = async (idLD) => {
|
||||
return "Unbekannt";
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------
|
||||
// services/apiService.js
|
||||
export const fetchUserRights = async () => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${urls.SERVER_URL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${config.idMap}&idUser=${config.idUser}`
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log("Benutzerrechte in fetchRights:", data);
|
||||
|
||||
// Überprüfen der Struktur der Antwort
|
||||
if (!data || !data.Rights || !Array.isArray(data.Rights)) {
|
||||
throw new Error("Invalid response structure");
|
||||
}
|
||||
|
||||
const rightsArray = data.Rights; // Nehmen an, dass 'Rights' das Array von Rechten ist
|
||||
console.log("rightsArray in apiService:", rightsArray);
|
||||
|
||||
// Speichert die IDs der Rechte in einem Array
|
||||
const userRightsIds = rightsArray.map((right) => right.IdRight);
|
||||
|
||||
// Wenn alles gut geht, logge die erfolgreichen Abschluss
|
||||
console.log("Benutzerrechte erfolgreich abgerufen:", userRightsIds);
|
||||
return userRightsIds;
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Abrufen der Benutzerrechte", error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user