- Globalen fetchAllTDRChartData entfernt - Neuen Slice und Thunk pro Slot erstellt - TDRChart liest initiale Daten aus neuem Slice
16 lines
522 B
TypeScript
16 lines
522 B
TypeScript
// /redux/thunks/fetchTDMDataBySlotThunk.ts
|
|
|
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
|
import { fetchTDMDataBySlot } from "../../services/fetchSingleTDMData";
|
|
import { setLoopMeasurementCurveChartData } from "../slices/kabelueberwachungChartSlice";
|
|
|
|
export const fetchTDMDataBySlotThunk = createAsyncThunk(
|
|
"tdmChart/fetchSlotData",
|
|
async (slot: number, { dispatch }) => {
|
|
const data = await fetchTDMDataBySlot(slot);
|
|
if (data) {
|
|
dispatch(setLoopMeasurementCurveChartData(data));
|
|
}
|
|
}
|
|
);
|