muss noch für update der Bereich Marker gearbeitet werden

This commit is contained in:
ISA
2024-12-20 14:50:30 +01:00
parent 6155561f14
commit a82a92e89a
3 changed files with 28 additions and 26 deletions

View File

@@ -43,7 +43,7 @@ const useBereicheMarkersLayer = (map, oms, apiUrl) => {
});
};
useEffect(() => {
/* useEffect(() => {
// Hole die Daten aus der API
const fetchBereiche = async () => {
try {
@@ -82,7 +82,7 @@ const useBereicheMarkersLayer = (map, oms, apiUrl) => {
};
fetchBereiche();
}, [apiUrl]);
}, [apiUrl]); */
useEffect(() => {
// Initialisiere die Sichtbarkeit beim ersten Laden
@@ -108,7 +108,7 @@ const useBereicheMarkersLayer = (map, oms, apiUrl) => {
clearInterval(intervalId);
};
}, [map, bereicheMarkers, oms]);
/*
useEffect(() => {
const fetchBereiche = async () => {
try {
@@ -124,9 +124,9 @@ const useBereicheMarkersLayer = (map, oms, apiUrl) => {
// Tooltip
marker.bindTooltip(
`
<strong>Bereich:</strong> ${item.location_name} <br />
<strong>Standort:</strong> ${item.area_name} <br />
`,
<strong>Bereich:</strong> ${item.location_name} <br />
<strong>Standort:</strong> ${item.area_name} <br />
`,
{
permanent: false,
direction: "top",
@@ -138,7 +138,8 @@ const useBereicheMarkersLayer = (map, oms, apiUrl) => {
marker.on("dragend", async (e) => {
const { lat, lng } = e.target.getLatLng();
try {
await updateLocation(item.idLocation, item.idMaps, { x: lat, y: lng });
// Update API aufrufen
await updateLocation(item.idLocation, item.idMaps, { x: lat, y: lng }); // Update-Funktion
console.log("Koordinaten erfolgreich aktualisiert:", { lat, lng });
} catch (error) {
console.error("Fehler beim Aktualisieren der Koordinaten:", error);
@@ -155,7 +156,7 @@ const useBereicheMarkersLayer = (map, oms, apiUrl) => {
};
fetchBereiche();
}, [apiUrl]); */
}, [apiUrl]);
useEffect(() => {
if (map) {