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.

reducer.js 879B

123456789101112131415161718192021222324252627282930
  1. import { assign, ReducerRegistry } from '../redux';
  2. import { HIDE_DIALOG, OPEN_DIALOG } from './actionTypes';
  3. /**
  4. * Reduces redux actions which show or hide dialogs.
  5. *
  6. * @param {State} state - The current redux state.
  7. * @param {Action} action - The redux action to reduce.
  8. * @param {string} action.type - The type of the redux action to reduce..
  9. * @returns {State} The next redux state that is the result of reducing the
  10. * specified action.
  11. */
  12. ReducerRegistry.register('features/base/dialog', (state = {}, action) => {
  13. switch (action.type) {
  14. case HIDE_DIALOG:
  15. return assign(state, {
  16. component: undefined,
  17. componentProps: undefined
  18. });
  19. case OPEN_DIALOG:
  20. return assign(state, {
  21. component: action.component,
  22. componentProps: action.componentProps
  23. });
  24. }
  25. return state;
  26. });