Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132
  1. // @flow
  2. import { equals, ReducerRegistry } from '../redux';
  3. import { SET_JWT } from './actionTypes';
  4. /**
  5. * Reduces redux actions which affect the JSON Web Token (JWT) stored in the
  6. * redux store.
  7. *
  8. * @param {Object} state - The current redux state.
  9. * @param {Object} action - The redux action to reduce.
  10. * @returns {Object} The next redux state which is the result of reducing the
  11. * specified {@code action}.
  12. */
  13. ReducerRegistry.register(
  14. 'features/base/jwt',
  15. (state = {}, action) => {
  16. switch (action.type) {
  17. case SET_JWT: {
  18. // eslint-disable-next-line no-unused-vars
  19. const { type, ...payload } = action;
  20. const nextState = {
  21. ...payload
  22. };
  23. return equals(state, nextState) ? state : nextState;
  24. }
  25. }
  26. return state;
  27. });