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.

middleware.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { appNavigate } from '../../app/actions';
  2. import { CONFERENCE_FAILED } from '../../base/conference/actionTypes';
  3. import { JitsiConferenceErrors } from '../../base/lib-jitsi-meet';
  4. import { MiddlewareRegistry } from '../../base/redux';
  5. MiddlewareRegistry.register(store => next => action => {
  6. switch (action.type) {
  7. case CONFERENCE_FAILED:
  8. return _conferenceFailed(store, next, action);
  9. }
  10. return next(action);
  11. });
  12. /**
  13. * Function to handle the conference failed event and navigate the user to the lobby screen
  14. * based on the failure reason.
  15. *
  16. * @param {Object} store - The Redux store.
  17. * @param {Function} next - The Redux next function.
  18. * @param {Object} action - The Redux action.
  19. * @returns {Object}
  20. */
  21. function _conferenceFailed({ dispatch }, next, action) {
  22. const { error } = action;
  23. // We need to cover the case where knocking participant
  24. // is rejected from entering the conference
  25. if (error.name === JitsiConferenceErrors.CONFERENCE_ACCESS_DENIED) {
  26. dispatch(appNavigate(undefined));
  27. }
  28. return next(action);
  29. }