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

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