Files
CPLv4.0/redux/thunks/fetchOpcUaSettingsThunk.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

25 lines
780 B
TypeScript

// ✅ 2. Thunk: /redux/thunks/fetchOpcUaSettingsThunk.ts
import { createAsyncThunk } from "@reduxjs/toolkit";
import { fetchOpcUaSettings } from "../../services/fetchOpcUaSettings";
import {
setOpcUaZustand,
setOpcUaEncryption,
setOpcUaActiveClientCount,
setOpcUaNodesetName,
setOpcUaUsers,
} from "../slices/opcuaSettingsSlice";
export const fetchOpcUaSettingsThunk = createAsyncThunk(
"opcuaSettings/fetch",
async (_, { dispatch }) => {
const data = await fetchOpcUaSettings();
if (!data) return;
dispatch(setOpcUaZustand(data.zustand));
dispatch(setOpcUaEncryption(data.encryption));
dispatch(setOpcUaActiveClientCount(data.clientCount));
dispatch(setOpcUaNodesetName(data.nodesetName));
dispatch(setOpcUaUsers(data.users));
}
);