gab-social/app/javascript/gabsocial/middleware/errors.js

18 lines
435 B
JavaScript
Raw Normal View History

2020-03-14 17:31:29 +00:00
// import { showAlertForError } from '../actions/alerts';
2019-07-02 08:10:25 +01:00
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)) {
2020-03-14 17:31:29 +00:00
// dispatch(showAlertForError(action.error));
2019-07-02 08:10:25 +01:00
}
}
return next(action);
};
};