2017-08-08 15:41:07 +08:00
|
|
|
import { message } from 'antd';
|
2017-08-08 14:25:33 +08:00
|
|
|
|
|
|
|
export default () => next => action => {
|
2017-08-16 18:04:16 +08:00
|
|
|
if(!action) return;
|
2017-08-08 14:25:33 +08:00
|
|
|
if (action.error) {
|
2017-08-08 15:41:07 +08:00
|
|
|
message.error((action.payload && action.payload.message) || '服务器错误');
|
2017-08-14 20:09:47 +08:00
|
|
|
} else if (action.payload && action.payload.data && action.payload.data.errcode && action.payload.data.errcode !== 40011) {
|
2017-08-08 15:41:07 +08:00
|
|
|
message.error(action.payload.data.errmsg);
|
2017-08-08 14:25:33 +08:00
|
|
|
}
|
|
|
|
return next(action);
|
|
|
|
};
|