feat: Änderungen werden von websocket zu client gesendet und Redux aktualisiert UI

This commit is contained in:
Ismail Ali
2025-06-07 14:25:42 +02:00
parent 17def7357c
commit a8978034d2
5 changed files with 91 additions and 52 deletions

View File

@@ -801,21 +801,18 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const params = new URLSearchParams(window.location.search);
const m = params.get("m");
const u = params.get("u");
const mode = process.env.NEXT_PUBLIC_USE_MOCKS === "true" ? "mock" : "prod";
const socket = io({
query: {
m,
u,
},
query: { m, u, mode },
});
socket.on("connect", () => {
console.log("🔗 Socket verbunden", socket.id);
console.log("🔗 WebSocket verbunden (Modus:", mode, ")");
});
socket.on("gisLinesStatusUpdated", newData => {
console.log("📡 Update erhalten für m/u:", m, u);
dispatch(fetchGisLinesStatusThunk(newData));
socket.on("gisLinesStatusUpdated", data => {
dispatch(fetchGisLinesStatusThunk(data));
});
return () => {