- Renamed all slice names (createSlice `name` attribute) to match their file names (e.g. loopChartSlice, authSlice, kueDataSlice etc.) - Updated `store.ts` to register each reducer with consistent key names (e.g. state.loopChartSlice instead of state.loopChart) - Adjusted all `useSelector` and Redux state accesses across the codebase - Improves maintainability, searchability and consistency across files and Redux DevTools
23 lines
561 B
TypeScript
23 lines
561 B
TypeScript
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
|
|
|
interface SelectedChartDataState {
|
|
selectedChartData: any;
|
|
}
|
|
|
|
const initialState: SelectedChartDataState = {
|
|
selectedChartData: null,
|
|
};
|
|
|
|
const selectedChartDataSlice = createSlice({
|
|
name: "selectedChartDataSlice",
|
|
initialState,
|
|
reducers: {
|
|
setSelectedChartData(state, action: PayloadAction<any>) {
|
|
state.selectedChartData = action.payload;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setSelectedChartData } = selectedChartDataSlice.actions;
|
|
export default selectedChartDataSlice.reducer;
|