mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-06 23:14:57 +00:00
3eede6f64b
Port front-end changes from 0d117c106a
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
18 lines
463 B
JavaScript
18 lines
463 B
JavaScript
import { showAlertForError } from 'flavours/glitch/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);
|
|
};
|
|
};
|