// ✅ 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));
  }
);
