refactor: digitale Ausgänge über eigenen Service und Redux Thunk laden
- neue Datei fetchDigitalOutputs.ts liest win_da_state und win_da_bezeichnung aus window - fetchDigitalOutputsThunk.ts verwendet den Service und befüllt Redux Slice - entfernt alte Logik aus loadWindowVariables.ts - verbessert Performance und Struktur, lädt Ausgänge nur bei Bedarf
This commit is contained in:
13
redux/thunks/fetchDigitalOutputsThunk.ts
Normal file
13
redux/thunks/fetchDigitalOutputsThunk.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
// ✅ Thunk: /redux/thunks/fetchDigitalOutputsThunk.ts
|
||||
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { fetchDigitalOutputs } from "../../services/fetchDigitalOutputs";
|
||||
import { setDigitalOutputs } from "../slices/digitalOutputsSlice";
|
||||
|
||||
export const fetchDigitalOutputsThunk = createAsyncThunk(
|
||||
"digitalOutputs/fetch",
|
||||
async (_, { dispatch }) => {
|
||||
const outputs = await fetchDigitalOutputs();
|
||||
dispatch(setDigitalOutputs(outputs));
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user