Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

middleware.js 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. declare var APP: Object;
  7. /**
  8. * The middleware of the feature {@code external-api}.
  9. *
  10. * @returns {Function}
  11. */
  12. MiddlewareRegistry.register((/* store */) => next => action => {
  13. switch (action.type) {
  14. case CONFERENCE_FAILED: {
  15. if (action.conference
  16. && action.error.name === JitsiConferenceErrors.PASSWORD_REQUIRED) {
  17. APP.API.notifyOnPasswordRequired();
  18. }
  19. break;
  20. }
  21. case NOTIFY_CAMERA_ERROR:
  22. if (action.error) {
  23. APP.API.notifyOnCameraError(
  24. action.error.name, action.error.message);
  25. }
  26. break;
  27. case NOTIFY_MIC_ERROR:
  28. if (action.error) {
  29. APP.API.notifyOnMicError(action.error.name, action.error.message);
  30. }
  31. break;
  32. }
  33. return next(action);
  34. });