errorsMiddleware: only alert when the error has a response (eg not when offline)
This commit is contained in:
parent
a16b246d41
commit
5a19d52617
1 changed files with 4 additions and 2 deletions
|
@ -3,8 +3,10 @@ import { showAlertForError } from '../actions/alerts';
|
|||
const isFailType = type => type.endsWith('_FAIL');
|
||||
const isRememberFailType = type => type.endsWith('_REMEMBER_FAIL');
|
||||
|
||||
const shouldShowError = ({ type, skipAlert }) => {
|
||||
return !skipAlert && isFailType(type) && !isRememberFailType(type);
|
||||
const hasResponse = error => Boolean(error && error.response);
|
||||
|
||||
const shouldShowError = ({ type, skipAlert, error }) => {
|
||||
return !skipAlert && hasResponse(error) && isFailType(type) && !isRememberFailType(type);
|
||||
};
|
||||
|
||||
export default function errorsMiddleware() {
|
||||
|
|
Loading…
Reference in a new issue