Files
CPLv4.0/redux/thunks/fetchOpcUaSettingsThunk.ts
Ismail Ali de9c6a7333 fix: API Endpoint in fetchOpcUaSettingsService für Development korrigiert
- falsches .js im API Pfad entfernt
- Development lädt jetzt korrekt /api/cpl/opcuaAPIHandler
- Production bleibt unverändert
2025-04-15 10:35:52 +02:00

25 lines
805 B
TypeScript

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