diff --git a/pages/_app.js b/pages/_app.js index 35e6ba1..d085ae2 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -13,11 +13,17 @@ function MyApp({ Component, pageProps }) { useEffect(() => { const loadAndStoreVariables = async () => { const variables = await loadWindowVariables(); - store.dispatch(setVariables(variables)); // Speichere die geladenen Variablen im Redux Store + store.dispatch(setVariables(variables)); }; if (typeof window !== "undefined") { - loadAndStoreVariables(); + loadAndStoreVariables(); // Initial load + + // Interval for updating the Redux store every 10 seconds + const intervalId = setInterval(loadAndStoreVariables, 10000); + + // Cleanup interval when component unmounts + return () => clearInterval(intervalId); } }, []);