- Globalen fetchAllTDRChartData entfernt - Neuen Slice und Thunk pro Slot erstellt - TDRChart liest initiale Daten aus neuem Slice
14 lines
466 B
TypeScript
14 lines
466 B
TypeScript
// /redux/thunks/fetchTDRChartDataBySlotThunk.ts
|
|
|
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
|
import { fetchTDRChartDataBySlot } from "../../services/fetchSingleTDRChartData";
|
|
|
|
export const fetchTDRChartDataBySlotThunk = createAsyncThunk(
|
|
"tdrChart/fetchSlotData",
|
|
async (slot: number) => {
|
|
const data = await fetchTDRChartDataBySlot(slot);
|
|
if (!data) throw new Error(`Daten für Slot ${slot} nicht gefunden`);
|
|
return { slot, data };
|
|
}
|
|
);
|