fix: Die Daten (.js) Kabelüberwachungsseite aktualisieren sich zwar alle paar Sekunden aber die Darstellung des BGT bleibt unverändert.
Bei der Kabelüberwachungsseite werden auch die analoge und digitale Eingänge geladen
This commit is contained in:
@@ -8,6 +8,7 @@ import { loadWindowVariables } from "../utils/loadWindowVariables";
|
||||
import Header from "../components/header/Header";
|
||||
import Navigation from "../components/navigation/Navigation";
|
||||
import Footer from "../components/footer/Footer";
|
||||
import { setKueData } from "../redux/slices/kueDataSlice";
|
||||
|
||||
import "../styles/globals.css";
|
||||
import { AppProps } from "next/app";
|
||||
@@ -25,14 +26,17 @@ function AppContent({ Component, pageProps }: AppProps) {
|
||||
const [sessionExpired, setSessionExpired] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let intervalId: NodeJS.Timeout;
|
||||
|
||||
const loadAndStoreVariables = async () => {
|
||||
try {
|
||||
const variables = await loadWindowVariables();
|
||||
const { variables, kueData } = await loadWindowVariables();
|
||||
if (!variables) throw new Error("Sitzungsfehler");
|
||||
|
||||
//console.log("✅ Window-Variablen geladen:", variables);
|
||||
|
||||
const { ...restVariables } = variables;
|
||||
// Nur auf kabelueberwachung.html Redux aktualisieren
|
||||
if (window.location.pathname.includes("kabelueberwachung")) {
|
||||
dispatch(setKueData(kueData));
|
||||
}
|
||||
|
||||
setSessionExpired(false);
|
||||
} catch (error) {
|
||||
@@ -44,13 +48,15 @@ function AppContent({ Component, pageProps }: AppProps) {
|
||||
if (typeof window !== "undefined") {
|
||||
loadAndStoreVariables();
|
||||
|
||||
const intervalId = setInterval(loadAndStoreVariables, 10000);
|
||||
// Nur auf kabelueberwachung.html regelmäßig aktualisieren
|
||||
if (window.location.pathname.includes("kabelueberwachung")) {
|
||||
intervalId = setInterval(loadAndStoreVariables, 10000);
|
||||
}
|
||||
|
||||
return () => clearInterval(intervalId);
|
||||
}
|
||||
}, []);
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-screen overflow-hidden">
|
||||
<Header />
|
||||
|
||||
Reference in New Issue
Block a user