yapi/client/reducer/middleware/messageMiddleware.js

11 lines
342 B
JavaScript
Raw Normal View History

2017-08-08 15:41:07 +08:00
import { message } from 'antd';
export default () => next => action => {
if (action.error) {
2017-08-08 15:41:07 +08:00
message.error((action.payload && action.payload.message) || '服务器错误');
} else if (action.payload && action.payload.data && action.payload.data.errcode) {
message.error(action.payload.data.errmsg);
}
return next(action);
};