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

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // @flow
  2. import { MiddlewareRegistry } from '../base/redux';
  3. import {
  4. CLOSE_PANEL,
  5. TOGGLE_CHAT,
  6. TOGGLE_PROFILE,
  7. TOGGLE_SETTINGS
  8. } from './actionTypes';
  9. declare var APP: Object;
  10. /**
  11. * Middleware that catches actions related to the non-reactified web side panel.
  12. *
  13. * @param {Store} store - Redux store.
  14. * @returns {Function}
  15. */
  16. // eslint-disable-next-line no-unused-vars
  17. MiddlewareRegistry.register(store => next => action => {
  18. if (typeof APP !== 'object') {
  19. return next(action);
  20. }
  21. switch (action.type) {
  22. case CLOSE_PANEL:
  23. APP.UI.toggleSidePanel(action.current);
  24. break;
  25. case TOGGLE_CHAT:
  26. APP.UI.toggleChat();
  27. break;
  28. case TOGGLE_PROFILE:
  29. APP.UI.toggleSidePanel('profile_container');
  30. break;
  31. case TOGGLE_SETTINGS:
  32. APP.UI.toggleSidePanel('settings_container');
  33. break;
  34. }
  35. return next(action);
  36. });