refactor: Services nach Datenquelle getrennt – webservice/, database/ und utils/ Struktur eingeführt (v1.1.117)

This commit is contained in:
ISA
2025-05-20 13:27:20 +02:00
parent e3b8f7f0fc
commit 2846bc0b13
17 changed files with 29 additions and 10 deletions

View File

@@ -0,0 +1,27 @@
// /services/api/fetchGisStatusStations.js
import fetchWithTimeout from "../utils/fetchWithTimeout";
export const fetchGisStatusStations = async (idMap, idUser) => {
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
const SERVER_URL = mode === "dev" ? `${window.location.protocol}//${window.location.hostname}:80` : `${window.location.origin}`;
return fetchWithTimeout(
`${SERVER_URL}/talas5/ClientData/WebServiceMap.asmx/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`,
{
method: "GET",
headers: {
Connection: "close",
},
},
5000
)
.then((response) => {
if (!response.ok) throw new Error(`Error: ${response.statusText}`);
return response.json();
})
.catch((error) => {
console.error("Fehler beim Abrufen der Daten in fetchGisStatusStations:", error);
throw error;
});
};