File size: 468 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { SHOW_MODAL, HIDE_MODAL } from '../actions/ui_actions';

const initialState = {
  modalType: null,
  modalProps: {}
};

const modalReducer = (state = initialState, action) => {
  Object.freeze(state);

  switch (action.type) {
    case SHOW_MODAL:
      return {
        modalProps: action.modalProps,
        modalType: action.modalType
      }
    case HIDE_MODAL:
      return initialState
    default:
      return state
  }
}

export default modalReducer;