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 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { ReducerRegistry } from '../base/redux';
  2. import {
  3. APP_SET_WELCOME_PAGE_DISABLED,
  4. APP_WILL_MOUNT,
  5. APP_WILL_UNMOUNT
  6. } from './actionTypes';
  7. ReducerRegistry.register('features/app', (state = {}, action) => {
  8. switch (action.type) {
  9. case APP_SET_WELCOME_PAGE_DISABLED:
  10. if (state.app === action.app) {
  11. return {
  12. ...state,
  13. disableWelcomePage: action.disabled
  14. };
  15. }
  16. break;
  17. case APP_WILL_MOUNT:
  18. if (state.app !== action.app) {
  19. return {
  20. ...state,
  21. /**
  22. * The one and only (i.e. singleton) App instance which is
  23. * currently mounted.
  24. *
  25. * @type {App}
  26. */
  27. app: action.app
  28. };
  29. }
  30. break;
  31. case APP_WILL_UNMOUNT:
  32. if (state.app === action.app) {
  33. return {
  34. ...state,
  35. app: undefined
  36. };
  37. }
  38. break;
  39. }
  40. return state;
  41. });