Letzte TDR-Messung anzeigen für ausgewählte Slot

This commit is contained in:
ISA
2025-03-28 12:26:43 +01:00
parent e2d8bb0f05
commit 37af5702fa
14 changed files with 61 additions and 163 deletions

View File

@@ -1,16 +1,10 @@
// redux/slices/tdrDataByIdSlice.ts
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { fetchTDRChartDataByIdThunk } from "../thunks/fetchTDRChartDataByIdThunk";
interface TDRDataState {
dataById: {
[id: number]: { d: number; p: number }[];
};
selectedId: number | null;
}
const initialState: TDRDataState = {
dataById: {},
selectedId: null,
const initialState = {
dataById: {} as Record<number, { d: number; p: number }[]>,
selectedId: null as number | null,
};
const tdrDataByIdSlice = createSlice({
@@ -27,6 +21,13 @@ const tdrDataByIdSlice = createSlice({
state.selectedId = action.payload;
},
},
extraReducers: (builder) => {
builder.addCase(fetchTDRChartDataByIdThunk.fulfilled, (state, action) => {
const { id, data } = action.payload;
state.dataById[id] = data;
state.selectedId = id;
});
},
});
export const { setTDRChartDataById, setSelectedTDRId } =