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.web.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { redirectToStaticPage } from '../app/actions';
  2. import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
  3. import {
  4. JitsiConferenceErrors,
  5. JitsiConferenceEvents
  6. } from '../base/lib-jitsi-meet';
  7. import { MiddlewareRegistry } from '../base/redux';
  8. import { SET_DETAILS } from './actionTypes';
  9. import { STATUSES } from './constants';
  10. import logger from './logger';
  11. /**
  12. * The redux middleware for jaas.
  13. *
  14. * @param {Store} store - The redux store.
  15. * @returns {Function}
  16. */
  17. MiddlewareRegistry.register(store => next => async action => {
  18. switch (action.type) {
  19. case CONFERENCE_JOINED: {
  20. const { conference } = action;
  21. if (store.getState()['features/base/config'].iAmRecorder) {
  22. // We don't register anything on web if we are in iAmRecorder mode
  23. return next(action);
  24. }
  25. conference.on(
  26. JitsiConferenceEvents.CONFERENCE_ERROR, (errorType, errorMsg) => {
  27. errorType === JitsiConferenceErrors.SETTINGS_ERROR && logger.error(errorMsg);
  28. });
  29. break;
  30. }
  31. case SET_DETAILS: {
  32. const { status } = action.payload;
  33. if (status === STATUSES.BLOCKED) {
  34. store.dispatch(redirectToStaticPage('/static/planLimit.html'));
  35. }
  36. break;
  37. }
  38. }
  39. return next(action);
  40. });