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 853B

12345678910111213141516171819202122232425262728293031
  1. import {
  2. CONFERENCE_JOINED,
  3. CONFERENCE_LEFT
  4. } from '../conference';
  5. import { MiddlewareRegistry } from '../redux';
  6. import { localParticipantIdChanged } from './actions';
  7. import { LOCAL_PARTICIPANT_DEFAULT_ID } from './constants';
  8. /**
  9. * Middleware that captures CONFERENCE_JOINED and CONFERENCE_LEFT actions and
  10. * updates respectively ID of local participant.
  11. *
  12. * @param {Store} store - Redux store.
  13. * @returns {Function}
  14. */
  15. MiddlewareRegistry.register(store => next => action => {
  16. switch (action.type) {
  17. case CONFERENCE_JOINED:
  18. store.dispatch(
  19. localParticipantIdChanged(
  20. action.conference.jitsiConference.myUserId()));
  21. break;
  22. case CONFERENCE_LEFT:
  23. store.dispatch(localParticipantIdChanged(LOCAL_PARTICIPANT_DEFAULT_ID));
  24. break;
  25. }
  26. return next(action);
  27. });