我想在出现内部错误时显示错误通知但是这不起作用我希望你能帮助我。
export const deleter = (url, params) => {
return(dispatch, getState, api) => {
api += 'api/';
return fetch(`${api}${url}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
.then(response => response.json())
.then(result => dispatch(departmentResult(result, types.DELETER)))
.catch(err => {
const errStatus = err.response ? err.response.status : 500;
if (errStatus == 500 || errStatus == 404){
return (NotificationManager.error('Sorry but this has already been used', 'ERROR! '));
} else {
return (NotificationManager.error('Sorry but this has already been used', 'ERROR! '));
}
});
}
}