feat: priorityConfig vollständig auf Redux umgestellt – Slice, Thunk und Service integriert und zentral ausgelagert
This commit is contained in:
@@ -59,6 +59,8 @@ import { fetchGisSystemStaticThunk } from "../../redux/thunks/webservice/fetchGi
|
||||
import { fetchGisStationsStaticDistrictThunk } from "../../redux/thunks/webservice/fetchGisStationsStaticDistrictThunk";
|
||||
import { fetchGisStationsStatusDistrictThunk } from "../../redux/thunks/webservice/fetchGisStationsStatusDistrictThunk";
|
||||
import { fetchLocationDevicesThunk } from "../../redux/thunks/database/fetchLocationDevicesThunk";
|
||||
import { fetchPriorityConfigThunk } from "../../redux/thunks/database/fetchPriorityConfigThunk";
|
||||
import { selectPriorityConfig } from "../../redux/slices/database/priorityConfigSlice";
|
||||
|
||||
const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -70,7 +72,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
const poiTypStatus = useSelector((state) => state.poiTypes.status);
|
||||
const isPoiTypLoaded = useSelector((state) => state.poiTypes.status === "succeeded");
|
||||
const [locationDeviceData, setLocationDeviceData] = useState([]);
|
||||
const [priorityConfig, setPriorityConfig] = useState([]);
|
||||
|
||||
const [menuItemAdded, setMenuItemAdded] = useState(false);
|
||||
const [isPopupOpen, setIsPopupOpen] = useState(false);
|
||||
|
||||
@@ -78,6 +80,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
const statusSystem = useSelector((state) => state.gisSystemStatic.status);
|
||||
const statusStaticDistrict = useSelector((state) => state.gisStationsStaticDistrict.status);
|
||||
const statusStatusDistrict = useSelector((state) => state.gisStationsStatusDistrict.status);
|
||||
const priorityConfig = useSelector(selectPriorityConfig);
|
||||
|
||||
const openPopupWithCoordinates = (e) => {
|
||||
const coordinates = `${e.latlng.lat.toFixed(5)}, ${e.latlng.lng.toFixed(5)}`;
|
||||
@@ -211,7 +214,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
dispatch(setUserId(params.get("u")));
|
||||
}, [dispatch]);
|
||||
//---------------------------------------------------------------
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetchPriorityConfigThunk());
|
||||
}, [dispatch]);
|
||||
//--------------------------------------------------------
|
||||
useEffect(() => {
|
||||
const endpoint = "/api/talas_v5_DB/gisLines/readGisLines";
|
||||
@@ -533,22 +538,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
}, [map, poiLayerRef, isPoiTypLoaded, menuItemAdded, hasRights, isRightsLoaded]);
|
||||
//--------------------------------------------
|
||||
// rote Marker ganz oben wenn überlappen sind
|
||||
useEffect(() => {
|
||||
const fetchPriorityConfig = async () => {
|
||||
try {
|
||||
const res = await fetch("/api/talas_v5_DB/priorityConfig");
|
||||
if (!res.ok) {
|
||||
throw new Error(`HTTP error! status: ${res.status}`);
|
||||
}
|
||||
const data = await res.json();
|
||||
setPriorityConfig(data);
|
||||
} catch (error) {
|
||||
console.error("Failed to load priority configuration:", error);
|
||||
}
|
||||
};
|
||||
|
||||
fetchPriorityConfig();
|
||||
}, []);
|
||||
//--------------------------------------------
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user