Nach Betriebsferien einmal sichern
This commit is contained in:
32
redux/slices/dateRangePickerSlice.ts
Normal file
32
redux/slices/dateRangePickerSlice.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
|
||||
interface DateRangePickerState {
|
||||
vonDatum: string | null;
|
||||
bisDatum: string | null;
|
||||
}
|
||||
|
||||
const initialState: DateRangePickerState = {
|
||||
vonDatum: null,
|
||||
bisDatum: null,
|
||||
};
|
||||
|
||||
const dateRangePickerSlice = createSlice({
|
||||
name: "dateRangePicker",
|
||||
initialState,
|
||||
reducers: {
|
||||
setVonDatum(state, action: PayloadAction<string>) {
|
||||
state.vonDatum = action.payload;
|
||||
},
|
||||
setBisDatum(state, action: PayloadAction<string>) {
|
||||
state.bisDatum = action.payload;
|
||||
},
|
||||
resetDateRange(state) {
|
||||
state.vonDatum = null;
|
||||
state.bisDatum = null;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { setVonDatum, setBisDatum, resetDateRange } =
|
||||
dateRangePickerSlice.actions;
|
||||
export default dateRangePickerSlice.reducer;
|
||||
@@ -38,6 +38,7 @@ import { combineReducers } from "@reduxjs/toolkit";
|
||||
import { useDispatch, useSelector, TypedUseSelectorHook } from "react-redux";
|
||||
import systemChartReducer from "./slices/systemChartSlice";
|
||||
import analogInputsUiReducer from "./slices/analogInputs/analogInputsUiSlice";
|
||||
import dateRangePickerReducer from "./slices/dateRangePickerSlice";
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
systemspannung5Vplus: systemspannung5VplusReducer,
|
||||
@@ -76,6 +77,7 @@ const rootReducer = combineReducers({
|
||||
analogInputsHistory: analogInputsHistoryReducer,
|
||||
selectedAnalogInput: selectedAnalogInputReducer,
|
||||
analogInputsUi: analogInputsUiReducer,
|
||||
dateRangePicker: dateRangePickerReducer,
|
||||
});
|
||||
// ⬆️ Alle deine Imports und combineReducers bleiben so wie du sie geschrieben hast ...
|
||||
|
||||
|
||||
@@ -21,7 +21,12 @@ export const getAnalogInputsHistoryThunk = createAsyncThunk(
|
||||
thunkAPI
|
||||
) => {
|
||||
try {
|
||||
const response = await fetchAnalogInputsHistory(eingang, zeitraum);
|
||||
const response = await fetchAnalogInputsHistory(
|
||||
eingang,
|
||||
zeitraum,
|
||||
vonDatum,
|
||||
bisDatum
|
||||
);
|
||||
|
||||
return {
|
||||
eingang,
|
||||
|
||||
Reference in New Issue
Block a user