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

12345678910111213141516171819202122232425
  1. /* @flow */
  2. import { MiddlewareRegistry } from '../../base/redux';
  3. import { TRACK_PERMISSION_ERROR } from '../../base/tracks';
  4. import { alertPermissionErrorWithSettings } from './functions';
  5. /**
  6. * Middleware that captures track permission errors and alerts the user so they
  7. * can enable the permission themselves.
  8. *
  9. * @param {Store} store - The redux store.
  10. * @returns {Function}
  11. */
  12. MiddlewareRegistry.register(() => next => action => {
  13. const result = next(action);
  14. switch (action.type) {
  15. case TRACK_PERMISSION_ERROR:
  16. alertPermissionErrorWithSettings(action.trackType);
  17. break;
  18. }
  19. return result;
  20. });