index.ts 441 B

123456789101112131415
  1. import * as actions from './main';
  2. import * as types from '../constants/actionTypes';
  3. const createReducer = (handlers: {[key: string]: any}) => (state: Object, action: { type: string }) => {
  4. if(!handlers.hasOwnProperty(action.type)) {
  5. return state;
  6. }
  7. return handlers[action.type](state, action);
  8. };
  9. export default createReducer({
  10. [types.SWITCH_NAVBAR]: actions.navbarState,
  11. [types.SWITCH_SIDEBAR]: actions.sidebarState,
  12. });