chore: fetch to get in redux thunks files name
This commit is contained in:
24
redux/thunks/getOpcUaSettingsThunk.ts
Normal file
24
redux/thunks/getOpcUaSettingsThunk.ts
Normal 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));
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user