Files
CPLv4.0/services/fetchOpcUaSettings.ts
ISA 7b85ebc730 refactor: lade OPC UA Daten direkt in NetworkInfo-Komponente statt global in _app.tsx
- Thunk `fetchOpcUaSettingsThunk` wird jetzt nur bei Anzeige von NetworkInfo ausgeführt
- Reduzierte Netzwerklast und bessere Trennung von Zuständigkeiten
- Entfernt globalen OPC UA-Aufruf aus _app.tsx
2025-03-26 10:45:00 +01:00

22 lines
618 B
TypeScript

// ✅ 1. Service: /services/fetchOpcUaSettings.ts
export const fetchOpcUaSettings = async () => {
try {
const win = window as any;
if (!win) return null;
const data = {
zustand: win.win_opcUaZustand || "Offline",
encryption: win.win_opcUaEncryption || "None",
clientCount: win.win_opcUaActiveClientCount || 0,
nodesetName: win.win_opcUaNodesetName || "DefaultNodeset",
users: Array.isArray(win.win_opcUaUsers) ? win.win_opcUaUsers : [],
};
return data;
} catch (error) {
console.error("Fehler beim Laden der OPC UA Daten:", error);
return null;
}
};