chore: fetch to get in redux thunks files name
This commit is contained in:
12
redux/thunks/getTDRChartDataByIdThunk.ts
Normal file
12
redux/thunks/getTDRChartDataByIdThunk.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// /redux/thunks/getTDRChartDataByIdThunk.ts
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { fetchTDRChartDataByIdService } from "../../services/fetchTDRChartDataByIdService";
|
||||
|
||||
export const getTDRChartDataByIdThunk = 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 };
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user