Funktion zum Aktualisieren der Position in der Datenbank
This commit is contained in:
@@ -25,6 +25,32 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
|
|
||||||
console.log("GisStationsStaticDistrict 1 :", GisStationsStaticDistrict);
|
console.log("GisStationsStaticDistrict 1 :", GisStationsStaticDistrict);
|
||||||
console.log("map:", map);
|
console.log("map:", map);
|
||||||
|
|
||||||
|
// Funktion zum Aktualisieren der Position in der Datenbank
|
||||||
|
const updateLocationInDatabase = async (id, newLatitude, newLongitude) => {
|
||||||
|
const response = await fetch("/api/updateLocation", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({
|
||||||
|
id,
|
||||||
|
latitude: newLatitude,
|
||||||
|
longitude: newLongitude,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
console.log("Position erfolgreich aktualisiert");
|
||||||
|
//schreib die neue Kooridnaten in die Console
|
||||||
|
console.log("Latitude: " + newLatitude);
|
||||||
|
console.log("Longitude: " + newLongitude);
|
||||||
|
console.log("ID: " + id);
|
||||||
|
console.log("Response: " + response);
|
||||||
|
//akuellisiere die Position in der Datenbank mit den neuen Koordinaten mit updateLocation mit SQL Anweisung UPDATE
|
||||||
|
} else {
|
||||||
|
console.error("Fehler beim Aktualisieren der Position");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//---
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
// API-Daten laden für GisStationsStaticDistrict
|
// API-Daten laden für GisStationsStaticDistrict
|
||||||
//http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsStaticDistrict?idMap=10&idUser=485
|
//http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsStaticDistrict?idMap=10&idUser=485
|
||||||
@@ -532,6 +558,8 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
map.addLayer(marker);
|
map.addLayer(marker);
|
||||||
//oms.addMarker(marker); // <-- here
|
//oms.addMarker(marker); // <-- here
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
//-------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user