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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // @flow
  2. import { CONFERENCE_FAILED } from '../base/conference';
  3. import { NOTIFY_CAMERA_ERROR, NOTIFY_MIC_ERROR } from '../base/devices';
  4. import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';
  5. import { MiddlewareRegistry } from '../base/redux';
  6. import { SUBMIT_FEEDBACK } from '../feedback';
  7. declare var APP: Object;
  8. /**
  9. * The middleware of the feature {@code external-api}.
  10. *
  11. * @returns {Function}
  12. */
  13. MiddlewareRegistry.register((/* store */) => next => action => {
  14. switch (action.type) {
  15. case CONFERENCE_FAILED: {
  16. if (action.conference
  17. && action.error.name === JitsiConferenceErrors.PASSWORD_REQUIRED) {
  18. APP.API.notifyOnPasswordRequired();
  19. }
  20. break;
  21. }
  22. case NOTIFY_CAMERA_ERROR:
  23. if (action.error) {
  24. APP.API.notifyOnCameraError(
  25. action.error.name, action.error.message);
  26. }
  27. break;
  28. case NOTIFY_MIC_ERROR:
  29. if (action.error) {
  30. APP.API.notifyOnMicError(action.error.name, action.error.message);
  31. }
  32. break;
  33. case SUBMIT_FEEDBACK:
  34. APP.API.notifyFeedbackSubmitted();
  35. break;
  36. }
  37. return next(action);
  38. });