You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
469 B

  1. import { MODAL_OPEN, MODAL_CLOSE } from '../actions/modal';
  2. const initialState = {
  3. modalType: null,
  4. modalProps: {},
  5. };
  6. export default function modal(state = initialState, action) {
  7. switch(action.type) {
  8. case MODAL_OPEN:
  9. return { modalType: action.modalType, modalProps: action.modalProps };
  10. case MODAL_CLOSE:
  11. return (action.modalType === undefined || action.modalType === state.modalType) ? initialState : state;
  12. default:
  13. return state;
  14. }
  15. };