TDR Chart von Dropdown Menü Auwahl zeichnen
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// /redux/slices/tdmChartSlice.ts
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { fetchAllTDMData } from "../thunks/fetchAllTDMThunk";
|
||||
import type { TDMEntry } from "../../types"; // optional, wenn ausgelagert
|
||||
|
||||
34
redux/slices/tdrDataByIdSlice.ts
Normal file
34
redux/slices/tdrDataByIdSlice.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
// redux/slices/tdrDataByIdSlice.ts
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
|
||||
interface TDRDataState {
|
||||
dataById: {
|
||||
[id: number]: { d: number; p: number }[];
|
||||
};
|
||||
selectedId: number | null;
|
||||
}
|
||||
|
||||
const initialState: TDRDataState = {
|
||||
dataById: {},
|
||||
selectedId: null,
|
||||
};
|
||||
|
||||
const tdrDataByIdSlice = createSlice({
|
||||
name: "tdrDataById",
|
||||
initialState,
|
||||
reducers: {
|
||||
setTDRChartDataById: (
|
||||
state,
|
||||
action: PayloadAction<{ id: number; data: { d: number; p: number }[] }>
|
||||
) => {
|
||||
state.dataById[action.payload.id] = action.payload.data;
|
||||
},
|
||||
setSelectedTDRId: (state, action: PayloadAction<number>) => {
|
||||
state.selectedId = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { setTDRChartDataById, setSelectedTDRId } =
|
||||
tdrDataByIdSlice.actions;
|
||||
export default tdrDataByIdSlice.reducer;
|
||||
@@ -17,6 +17,7 @@ import digitalInputsReducer from "./slices/digitalInputsSlice";
|
||||
import tdrReferenceChartReducer from "./slices/tdrReferenceChartSlice";
|
||||
import loopChartReducer from "./slices/loopChartSlice";
|
||||
import tdmChartReducer from "./slices/tdmChartSlice";
|
||||
import tdrDataByIdReducer from "./slices/tdrDataByIdSlice";
|
||||
|
||||
const store = configureStore({
|
||||
reducer: {
|
||||
@@ -36,6 +37,7 @@ const store = configureStore({
|
||||
tdrReferenceChart: tdrReferenceChartReducer,
|
||||
loopChart: loopChartReducer,
|
||||
tdmChart: tdmChartReducer,
|
||||
tdrDataById: tdrDataByIdReducer,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user