// /redux/thunks/fetchTDRChartDataByIdThunk.ts
import { createAsyncThunk } from "@reduxjs/toolkit";
import { fetchTDRChartDataByIdService } from "../../services/fetchTDRChartDataByIdService";

export const fetchTDRChartDataByIdThunk = createAsyncThunk(
  "tdrDataById/fetchById",
  async (id: number) => {
    const data = await fetchTDRChartDataByIdService(id);
    if (!data) throw new Error(`Keine TDR-Daten für ID ${id}`);
    return { id, data };
  }
);
