您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

reducer.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { equals, set, ReducerRegistry } from '../base/redux';
  2. import { SET_CALL_OVERLAY_VISIBLE, SET_JWT } from './actionTypes';
  3. /**
  4. * The initial redux state of the feature jwt.
  5. *
  6. * @private
  7. * @type {{
  8. * isGuest: boolean
  9. * }}
  10. */
  11. const _INITIAL_STATE = {
  12. /**
  13. * The indicator which determines whether (the) {@code CallOverlay} is
  14. * visible.
  15. *
  16. * @type {boolean|undefined}
  17. */
  18. callOverlayVisible: undefined,
  19. /**
  20. * The indicator which determines whether the local participant is a guest
  21. * in the conference.
  22. *
  23. * @type {boolean}
  24. */
  25. isGuest: true
  26. };
  27. /**
  28. * Reduces redux actions which affect the JSON Web Token (JWT) stored in the
  29. * redux store.
  30. *
  31. * @param {Object} state - The current redux state.
  32. * @param {Object} action - The redux action to reduce.
  33. * @returns {Object} The next redux state which is the result of reducing the
  34. * specified {@code action}.
  35. */
  36. ReducerRegistry.register('features/jwt', (state = _INITIAL_STATE, action) => {
  37. switch (action.type) {
  38. case SET_CALL_OVERLAY_VISIBLE:
  39. return set(state, 'callOverlayVisible', action.callOverlayVisible);
  40. case SET_JWT: {
  41. // eslint-disable-next-line no-unused-vars
  42. const { type, ...payload } = action;
  43. const nextState = {
  44. ..._INITIAL_STATE,
  45. ...payload
  46. };
  47. return equals(state, nextState) ? state : nextState;
  48. }
  49. }
  50. return state;
  51. });