闭社主体 forked from https://github.com/tootsuite/mastodon
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.

21 lines
508 B

  1. import { MEDIA_OPEN, MODAL_CLOSE } from '../actions/modal';
  2. import Immutable from 'immutable';
  3. const initialState = Immutable.Map({
  4. url: '',
  5. open: false
  6. });
  7. export default function modal(state = initialState, action) {
  8. switch(action.type) {
  9. case MEDIA_OPEN:
  10. return state.withMutations(map => {
  11. map.set('url', action.url);
  12. map.set('open', true);
  13. });
  14. case MODAL_CLOSE:
  15. return state.set('open', false);
  16. default:
  17. return state;
  18. }
  19. };