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. /* global APP */
  2. import JitsiMeetJS from '../base/lib-jitsi-meet';
  3. import { CONFERENCE_FAILED } from '../base/conference';
  4. import { MiddlewareRegistry } from '../base/redux';
  5. import { _showPasswordDialog } from './actions';
  6. /**
  7. * Middleware that captures conference failed and checks for password required
  8. * error and requests a dialog for user to enter password.
  9. *
  10. * @param {Store} store - Redux store.
  11. * @returns {Function}
  12. */
  13. MiddlewareRegistry.register(store => next => action => {
  14. switch (action.type) {
  15. case CONFERENCE_FAILED: {
  16. const JitsiConferenceErrors = JitsiMeetJS.errors.conference;
  17. if (action.conference
  18. && JitsiConferenceErrors.PASSWORD_REQUIRED === action.error) {
  19. // XXX temporary solution till we move the whole invite
  20. // logic in react
  21. if (typeof APP !== 'undefined') {
  22. APP.conference.invite.setLockedFromElsewhere(true);
  23. }
  24. store.dispatch(_showPasswordDialog(action.conference));
  25. }
  26. break;
  27. }
  28. }
  29. return next(action);
  30. });