1
0
mirror of https://github.com/glitch-soc/mastodon.git synced 2025-02-13 06:03:49 -05:00
Nick Schonning 06b68490d1
Enable eslint:recommended ruleset ()
* Enable ESLint recommended ruleset

* Disable failing ESLint recommended rules

* Remove rules shadowed by eslint:recommended
2022-12-19 00:51:37 +09:00

18 lines
449 B
JavaScript

import { showAlertForError } from '../actions/alerts';
const defaultFailSuffix = 'FAIL';
export default function errorsMiddleware() {
return ({ dispatch }) => next => action => {
if (action.type && !action.skipAlert) {
const isFail = new RegExp(`${defaultFailSuffix}$`, 'g');
if (action.type.match(isFail)) {
dispatch(showAlertForError(action.error, action.skipNotFound));
}
}
return next(action);
};
}