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

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import ReducerRegistry from '../redux/ReducerRegistry';
  2. import { SET_PRECALL_TEST_RESULTS, SET_UNSAFE_ROOM_CONSENT } from './actionTypes';
  3. import { IPreMeetingState, PreCallTestStatus } from './types';
  4. const DEFAULT_STATE: IPreMeetingState = {
  5. preCallTestState: {
  6. status: PreCallTestStatus.INITIAL
  7. },
  8. unsafeRoomConsent: false
  9. };
  10. /**
  11. * Listen for actions which changes the state of known and used devices.
  12. *
  13. * @param {IDevicesState} state - The Redux state of the feature features/base/devices.
  14. * @param {Object} action - Action object.
  15. * @param {string} action.type - Type of action.
  16. * @returns {IPreMeetingState}
  17. */
  18. ReducerRegistry.register<IPreMeetingState>(
  19. 'features/base/premeeting',
  20. (state = DEFAULT_STATE, action): IPreMeetingState => {
  21. switch (action.type) {
  22. case SET_PRECALL_TEST_RESULTS:
  23. return {
  24. ...state,
  25. preCallTestState: action.value
  26. };
  27. case SET_UNSAFE_ROOM_CONSENT: {
  28. return {
  29. ...state,
  30. unsafeRoomConsent: action.consent
  31. };
  32. }
  33. default:
  34. return state;
  35. }
  36. });