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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // @flow
  2. import { ReducerRegistry } from '../redux';
  3. import {
  4. LIB_DID_DISPOSE,
  5. LIB_DID_INIT,
  6. LIB_INIT_ERROR,
  7. LIB_INIT_PROMISE_CREATED,
  8. SET_WEBRTC_READY
  9. } from './actionTypes';
  10. /**
  11. * The default/initial redux state of the feature base/lib-jitsi-meet.
  12. *
  13. * @type {Object}
  14. */
  15. const DEFAULT_STATE = {};
  16. ReducerRegistry.register(
  17. 'features/base/lib-jitsi-meet',
  18. (state = DEFAULT_STATE, action) => {
  19. switch (action.type) {
  20. case LIB_DID_DISPOSE:
  21. return DEFAULT_STATE;
  22. case LIB_DID_INIT:
  23. return {
  24. ...state,
  25. initError: undefined,
  26. initialized: true
  27. };
  28. case LIB_INIT_ERROR:
  29. return {
  30. ...state,
  31. initError: action.error,
  32. initialized: false,
  33. initPromise: undefined
  34. };
  35. case LIB_INIT_PROMISE_CREATED:
  36. return {
  37. ...state,
  38. initPromise: action.initPromise
  39. };
  40. case SET_WEBRTC_READY:
  41. return {
  42. ...state,
  43. webRTCReady: action.webRTCReady
  44. };
  45. default:
  46. return state;
  47. }
  48. });