chore: fetch to get in redux thunks files name

This commit is contained in:
Ismail Ali
2025-06-21 10:15:05 +02:00
parent dd76665848
commit 7740806952
42 changed files with 144 additions and 126 deletions

View File

@@ -0,0 +1,24 @@
// ✅ 2. Thunk: /redux/thunks/getOpcUaSettingsThunk.ts
import { createAsyncThunk } from "@reduxjs/toolkit";
import { fetchOpcUaSettingsService } from "../../services/fetchOpcUaSettingsService";
import {
setOpcUaZustand,
setOpcUaEncryption,
setOpcUaActiveClientCount,
setOpcUaNodesetName,
//setOpcUaUsers,
} from "../slices/opcuaSettingsSlice";
export const getOpcUaSettingsThunk = 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));
}
);