Vous ne pouvez pas sélectionner plus de 25 sujets
Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
|
- 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));
- }
- }
-
- return next(action);
- };
- };
|