您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

middleware.ts 746B

12345678910111213141516171819202122232425
  1. import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
  2. import { showErrorNotification } from '../notifications/actions';
  3. import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
  4. import { TRANSCRIBER_LEFT } from './actionTypes';
  5. /**
  6. * Implements the middleware of the feature transcribing.
  7. *
  8. * @param {Store} store - The redux store.
  9. * @returns {Function}
  10. */
  11. MiddlewareRegistry.register(({ dispatch }) => next => action => {
  12. switch (action.type) {
  13. case TRANSCRIBER_LEFT:
  14. if (action.abruptly) {
  15. dispatch(showErrorNotification({
  16. titleKey: 'transcribing.failed'
  17. }, NOTIFICATION_TIMEOUT_TYPE.LONG));
  18. }
  19. break;
  20. }
  21. return next(action);
  22. });