// ✅ Thunk: /redux/thunks/fetchDigitalOutputsThunk.ts

import { createAsyncThunk } from "@reduxjs/toolkit";
import { fetchDigitalOutputsService } from "../../services/fetchDigitalOutputsService";
import { setDigitalOutputs } from "../slices/digitalOutputsSlice";

export const fetchDigitalOutputsThunk = createAsyncThunk(
  "digitalOutputs/fetch",
  async (_, { dispatch }) => {
    const outputs = await fetchDigitalOutputsService();
    dispatch(setDigitalOutputs(outputs));
  }
);
