refactor: Systemdaten über eigenen Redux Thunk und Service laden

- Systeminformationen (IP, Subnetz, Gateway, NTP, etc.) werden nun über fetchSystemSettingsThunk geladen
- loadWindowVariables.ts von systemSettings-Logik bereinigt
- Aufruf erfolgt lokal in NetworkInfo.tsx statt global in _app.tsx
- Verbesserte Struktur, reduzierte Netzwerklast, klarere Trennung der Zuständigkeiten
This commit is contained in:
ISA
2025-03-26 11:28:13 +01:00
parent 7b85ebc730
commit fa94d2c2f7
6 changed files with 32 additions and 57 deletions

View File

@@ -4,14 +4,12 @@
import { useEffect, useState } from "react";
import { Provider } from "react-redux";
import store, { useAppDispatch } from "../redux/store";
import { loadWindowVariables } from "../utils/loadWindowVariables";
import Header from "../components/header/Header";
import Navigation from "../components/navigation/Navigation";
import Footer from "../components/footer/Footer";
import WindowVariablesInitializer from "../components/WindowVariablesInitializer";
import "../styles/globals.css";
import { AppProps } from "next/app";
import { setVariables } from "../redux/slices/variablesSlice";
function MyApp({ Component, pageProps }: AppProps) {
return (
@@ -28,28 +26,6 @@ function AppContent({ Component, pageProps }: AppProps) {
useEffect(() => {
const loadAndStoreVariables = async () => {
try {
const variables = await loadWindowVariables();
if (!variables) throw new Error("Sitzungsfehler");
//console.log("✅ Window-Variablen geladen:", variables);
const {
deviceName,
mac1,
ip,
subnet,
gateway,
cplInternalTimestamp,
ntp1,
ntp2,
ntp3,
ntpTimezone,
ntpActive,
...restVariables
} = variables;
dispatch(setVariables(restVariables));
setSessionExpired(false);
} catch (error) {
console.error("❌ Fehler beim Laden der Sitzung:", error);