fork from bc4552c5a8
This commit is contained in:
19
client/reducer/middleware/messageMiddleware.js
Normal file
19
client/reducer/middleware/messageMiddleware.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { message } from 'antd';
|
||||
|
||||
export default () => next => action => {
|
||||
if (!action) {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
throw new Error(action.payload.data.errmsg);
|
||||
}
|
||||
return next(action);
|
||||
};
|
||||
Reference in New Issue
Block a user