mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-27 05:30:14 +08:00
17 lines
504 B
JavaScript
17 lines
504 B
JavaScript
import process from 'process';
|
|
import { Message } from 'antd';
|
|
|
|
export default () => next => action => {
|
|
if (process.browser) {
|
|
if (action.error) {
|
|
Message.error('服务器错误');
|
|
} else if (action.payload && action.payload.res === false) {
|
|
const hasChinese = /[\u4E00-\u9FFF]+/g.test(action.payload.message);
|
|
const message = hasChinese ? action.payload.message : '服务器错误';
|
|
Message.error(message);
|
|
}
|
|
return next(action);
|
|
}
|
|
return next(action);
|
|
};
|