yapi/client/reducer/middleware/messageMiddleware.js
2017-08-15 12:08:59 +08:00

11 lines
383 B
JavaScript

import { message } from 'antd';
export default () => next => action => {
if (action.error) {
message.error((action.payload && action.payload.message) || '服务器错误');
} else if (action.payload && action.payload.data && action.payload.data.errcode && action.payload.data.errcode !== 40011) {
message.error(action.payload.data.errmsg);
}
return next(action);
};