talas5 Verzeichnis gelöscht, weil ich bekomme alles von WebServices und in der Produktionsumgebung läuft Entwicklungsumgebung
This commit is contained in:
17
services/fetchGisStationsStaticDistrict.js
Normal file
17
services/fetchGisStationsStaticDistrict.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { setGisStationsStaticDistrict } from "../../redux/slices/gisStationsStaticDistrictSlice";
|
||||
|
||||
export const fetchGisStationsStaticDistrict = async (url, dispatch, fetchOptions) => {
|
||||
try {
|
||||
const response = await fetch(url, fetchOptions);
|
||||
const jsonResponse = await response.json();
|
||||
if (jsonResponse && jsonResponse.Points) {
|
||||
dispatch(setGisStationsStaticDistrict(jsonResponse.Points));
|
||||
} else {
|
||||
console.error('Erwartete Daten im "Points"-Array nicht gefunden', jsonResponse);
|
||||
dispatch(setGisStationsStaticDistrict([]));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Laden der Daten: ", error);
|
||||
dispatch(setGisStationsStaticDistrict([]));
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user