refactor: Move API-Endpoint-Functions to /api/talas_v5_DB/ folder for better organization
This commit is contained in:
@@ -128,7 +128,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
};
|
||||
|
||||
const fetchPoiData = async (idPoi) => {
|
||||
const response = await fetch(`/api/getPoiById?idPoi=${idPoi}`);
|
||||
const response = await fetch(
|
||||
`/api/talas_v5_DB/pois/getPoiById?idPoi=${idPoi}`
|
||||
);
|
||||
if (!response.ok) {
|
||||
console.error("Fehler beim Abrufen der POI-Daten");
|
||||
return;
|
||||
@@ -227,7 +229,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
};
|
||||
// Funktion zum Aktualisieren der Position in der Datenbank
|
||||
const updateLocationInDatabase = async (id, newLatitude, newLongitude) => {
|
||||
const response = await fetch("/api/updateLocation", {
|
||||
const response = await fetch("/api/talas_v5_DB/pois/updateLocation", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
@@ -1044,7 +1046,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
useEffect(() => {
|
||||
const fetchPoiTypData = async () => {
|
||||
try {
|
||||
const response = await fetch("/api/readPoiTyp");
|
||||
const response = await fetch("/api/talas_v5_DB/poiTyp/readPoiTyp");
|
||||
const data = await response.json();
|
||||
setPoiTypData(data); // Daten im Recoil State speichern
|
||||
} catch (error) {
|
||||
@@ -1069,7 +1071,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
useEffect(() => {
|
||||
const fetchPoiTypData = async () => {
|
||||
try {
|
||||
const response = await fetch("/api/readPoiTyp");
|
||||
const response = await fetch("/api/talas_v5_DB/poiTyp/readPoiTyp");
|
||||
const data = await response.json();
|
||||
const map = new Map();
|
||||
data.forEach((item) => map.set(item.idPoiTyp, item.name));
|
||||
@@ -1135,7 +1137,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
|
||||
const fetchDeviceNameById = async (idLD) => {
|
||||
try {
|
||||
const response = await fetch(`/api/locationDeviceNameById?idLD=${idLD}`);
|
||||
const response = await fetch(
|
||||
`/api/talas_v5_DB/locationDevice/locationDeviceNameById?idLD=${idLD}`
|
||||
);
|
||||
const data = await response.json();
|
||||
if (response.ok) {
|
||||
return data.name;
|
||||
@@ -1197,7 +1201,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
|
||||
useEffect(() => {
|
||||
const fetchPoiData = async () => {
|
||||
const response = await fetch("/api/poi-icons");
|
||||
const response = await fetch("/api/talas_v5_DB/pois/poi-icons");
|
||||
const data = await response.json();
|
||||
setPoiData(data);
|
||||
//console.log("poiData icons:", data);
|
||||
|
||||
Reference in New Issue
Block a user