PromucFlow_constructor/app/client/src/reducers/uiReducers/helpReducer.ts

32 lines
771 B
TypeScript
Raw Normal View History

2020-05-28 18:10:26 +00:00
import { createReducer } from "utils/AppsmithUtils";
import { ReduxAction, ReduxActionTypes } from "constants/ReduxActionConstants";
const initialState: HelpReduxState = {
url: "",
modalOpen: false,
defaultRefinement: "",
};
const helpReducer = createReducer(initialState, {
[ReduxActionTypes.SET_DEFAULT_REFINEMENT]: (
state: HelpReduxState,
action: ReduxAction<string>,
) => {
return { ...state, defaultRefinement: action.payload };
},
[ReduxActionTypes.SET_HELP_MODAL_OPEN]: (
state: HelpReduxState,
action: ReduxAction<boolean>,
) => {
return { ...state, modalOpen: action.payload };
},
});
export interface HelpReduxState {
url: string;
modalOpen: boolean;
defaultRefinement: string;
}
export default helpReducer;