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.

20 lines
626 B

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