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 1020B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { assign, ReducerRegistry } from '../redux';
  2. import { SET_CONNECTION_STATE } from './actionTypes';
  3. /**
  4. * The initial state of the feature testing.
  5. *
  6. * @type {{
  7. * connectionState: string
  8. * }}
  9. */
  10. const INITIAL_STATE = {
  11. connectionState: ''
  12. };
  13. ReducerRegistry.register(
  14. 'features/testing',
  15. (state = INITIAL_STATE, action) => {
  16. switch (action.type) {
  17. case SET_CONNECTION_STATE:
  18. return _setConnectionState(state, action);
  19. default:
  20. return state;
  21. }
  22. });
  23. /**
  24. * Reduces a specific Redux action SET_CONNECTION_STATE of the feature
  25. * testing.
  26. *
  27. * @param {Object} state - The Redux state of the feature base/logging.
  28. * @param {Action} action - The Redux action SET_CONNECTION_STATE to reduce.
  29. * @private
  30. * @returns {Object} The new state of the feature testing after the
  31. * reduction of the specified action.
  32. */
  33. function _setConnectionState(state, action) {
  34. return assign(state, { connectionState: action.connectionState });
  35. }