您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

middleware.ts 1.2KB

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