Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

reducer.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { equals, ReducerRegistry } from '../base/redux';
  2. import { 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 local participant is a guest
  14. * in the conference.
  15. *
  16. * @type {boolean}
  17. */
  18. isGuest: true
  19. };
  20. /**
  21. * Reduces redux actions which affect the JSON Web Token (JWT) stored in the
  22. * redux store.
  23. *
  24. * @param {Object} state - The current redux state.
  25. * @param {Object} action - The redux action to reduce.
  26. * @returns {Object} The next redux state which is the result of reducing the
  27. * specified {@code action}.
  28. */
  29. ReducerRegistry.register('features/jwt', (state = _INITIAL_STATE, action) => {
  30. switch (action.type) {
  31. case SET_JWT: {
  32. // eslint-disable-next-line no-unused-vars
  33. const { type, ...payload } = action;
  34. const nextState = {
  35. ..._INITIAL_STATE,
  36. ...payload
  37. };
  38. return equals(state, nextState) ? state : nextState;
  39. }
  40. }
  41. return state;
  42. });