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.ts 1.2KB

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