mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-24 13:14:16 +08:00
feat: 增加全局错误提示
This commit is contained in:
parent
5d5c63f8ec
commit
80be4a089c
4
.tags
4
.tags
@ -291,3 +291,7 @@ case.development /Users/qitmac000445/Desktop/YAPI/yapi/ykit.js /^ ENV
|
||||
createStore /Users/qitmac000445/Desktop/YAPI/yapi/client/reducer/create.js /^export default function createStore(initialState = {}) {$/;" function line:8
|
||||
module.exports.parser /Users/qitmac000445/Desktop/YAPI/yapi/client/.eslintrc.js /^module.exports = {$/;" property line:1
|
||||
module.exports.extends /Users/qitmac000445/Desktop/YAPI/yapi/client/.eslintrc.js /^ parser: 'babel-eslint',$/;" property line:2
|
||||
const.groupList /Users/qitmac000445/Desktop/YAPI/yapi/client/reducer/modules/group.js /^const initialState = {$/;" property line:8
|
||||
switch /Users/qitmac000445/Desktop/YAPI/yapi/client/reducer/modules/group.js /^ switch (action.type) {$/;" function line:14
|
||||
fetchGroupList /Users/qitmac000445/Desktop/YAPI/yapi/client/reducer/modules/group.js /^export function fetchGroupList() {$/;" function line:34
|
||||
setCurrGroup /Users/qitmac000445/Desktop/YAPI/yapi/client/reducer/modules/group.js /^export function setCurrGroup(group) {$/;" function line:41
|
||||
|
2
.tags1
2
.tags1
@ -4,5 +4,3 @@
|
||||
!_TAG_PROGRAM_NAME Exuberant Ctags //
|
||||
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
|
||||
!_TAG_PROGRAM_VERSION 5.8 //
|
||||
module.exports.parser /Users/qitmac000445/Desktop/YAPI/yapi/client/.eslintrc.js /^module.exports = {$/;" property line:1
|
||||
module.exports.extends /Users/qitmac000445/Desktop/YAPI/yapi/client/.eslintrc.js /^ parser: 'babel-eslint',$/;" property line:2
|
||||
|
@ -1,12 +1,10 @@
|
||||
import { Message } from 'antd';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default () => next => action => {
|
||||
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);
|
||||
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);
|
||||
};
|
||||
|
@ -1,5 +1,4 @@
|
||||
import axios from 'axios';
|
||||
import { message } from 'antd'
|
||||
|
||||
// Actions
|
||||
const FETCH_GROUP_LIST = 'yapi/group/FETCH_GROUP_LIST';
|
||||
@ -14,15 +13,10 @@ const initialState = {
|
||||
export default (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
case FETCH_GROUP_LIST: {
|
||||
if (action.payload.data.errcode) {
|
||||
message.error(action.payload.data.errmsg);
|
||||
} else {
|
||||
return {
|
||||
...state,
|
||||
groupList: action.payload.data.data
|
||||
};
|
||||
}
|
||||
return state;
|
||||
return {
|
||||
...state,
|
||||
groupList: action.payload.data.data
|
||||
};
|
||||
}
|
||||
case SET_CURR_GROUP: {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user