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 794B

12345678910111213141516171819202122232425262728293031
  1. import { ReducerRegistry, setStateProperties } from '../redux';
  2. import {
  3. HIDE_DIALOG,
  4. OPEN_DIALOG
  5. } from './actionTypes';
  6. /**
  7. * Listen for actions which show or hide dialogs.
  8. *
  9. * @param {Object[]} state - Current state.
  10. * @param {Object} action - Action object.
  11. * @param {string} action.type - Type of action.
  12. * @returns {{}}
  13. */
  14. ReducerRegistry.register('features/base/dialog', (state = {}, action) => {
  15. switch (action.type) {
  16. case HIDE_DIALOG:
  17. return setStateProperties(state, {
  18. component: undefined,
  19. componentProps: undefined
  20. });
  21. case OPEN_DIALOG:
  22. return setStateProperties(state, {
  23. component: action.component,
  24. componentProps: action.componentProps
  25. });
  26. }
  27. return state;
  28. });