Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // @flow
  2. import { openDialog } from '../base/dialog';
  3. import { MiddlewareRegistry } from '../base/redux';
  4. import { BEGIN_ADD_PEOPLE } from './actionTypes';
  5. import { AddPeopleDialog } from './components';
  6. import './middleware.any';
  7. /**
  8. * The middleware of the feature invite specific to Web/React.
  9. *
  10. * @param {Store} store - The redux store.
  11. * @returns {Function}
  12. */
  13. MiddlewareRegistry.register(store => next => action => {
  14. switch (action.type) {
  15. case BEGIN_ADD_PEOPLE:
  16. return _beginAddPeople(store, next, action);
  17. }
  18. return next(action);
  19. });
  20. /**
  21. * Notifies the feature invite that the action {@link BEGIN_ADD_PEOPLE} is being
  22. * dispatched within a specific redux {@code store}.
  23. *
  24. * @param {Store} store - The redux store in which the specified {@code action}
  25. * is being dispatched.
  26. * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
  27. * specified {@code action} to the specified {@code store}.
  28. * @param {Action} action - The redux action {@code BEGIN_ADD_PEOPLE} which is
  29. * being dispatched in the specified {@code store}.
  30. * @private
  31. * @returns {*} The value returned by {@code next(action)}.
  32. */
  33. function _beginAddPeople({ dispatch }, next, action) {
  34. const result = next(action);
  35. dispatch(openDialog(AddPeopleDialog));
  36. return result;
  37. }