Commit 1d74834f by zhaochengxiang

增加网络请求错误提示

parent 837b3fbe
import { createStore, applyMiddleware } from 'redux'
import createSagaMiddleware from 'redux-saga'
import { all, call, takeLatest, takeEvery, cancelled } from 'redux-saga/effects'
import { message } from 'antd'
import { SetSource, Cancel } from '../util/axios'
import { Connect } from '../util';
import { Connect, showMessage } from '../util';
import { reducers } from './reducer';
import * as user from './user';
import * as map from './map';
......@@ -21,7 +20,7 @@ function* request(args) {
if (callback)
yield call(callback, rs)
} catch (ex) {
ex.ApiError && ex.ApiError.message && message.error(ex.ApiError.message);
ex.ApiError && ex.ApiError.cnMessage && showMessage('error', ex.ApiError.cnMessage);
error && error(ex);
}finally {
if (yield cancelled()) {
......
......@@ -95,11 +95,7 @@ const callback = resp => {
return null;
}
else if (resp.status !== 200) {
if (resp && resp.data && resp.data.ApiError && resp.data.ApiError.cnMessage) {
showMessage('warn', resp.data.ApiError.cnMessage||'');
}
return null;
throw resp.data;
}
return resp.data || resp;
......
......@@ -43,6 +43,9 @@ class MapContent extends React.Component {
}, () => {
this.setAllTreeGraphState(data||[]);
});
},
error: () => {
this.setState({ loading: false })
}
})
})
......
......@@ -28,6 +28,9 @@ class Map extends React.Component {
loadingTopics: false,
topics: data
});
},
error: () => {
this.setState({ loadingTopics: false });
}
})
})
......
......@@ -63,6 +63,9 @@ class ImportMetadata extends React.Component {
} else {
this.setState({ loadingSystem: false });
}
},
error: () => {
this.setState({ loadingSystem: false });
}
})
})
......@@ -88,6 +91,9 @@ class ImportMetadata extends React.Component {
},
callback: dbs => {
this.setState({ loadingDb: false, dbs: dbs||[], db: '', schema: '' })
},
erorr: () => {
this.setState({ loadingDb: false });
}
});
});
......@@ -112,6 +118,9 @@ class ImportMetadata extends React.Component {
},
callback: schemas => {
this.setState({ loadingSchema: false, schemas, schema: '' });
},
error: () => {
this.setState({ loadingSchema: false });
}
});
})
......@@ -158,6 +167,9 @@ class ImportMetadata extends React.Component {
},
callback: data => {
this.setState({ loadingDataTable: false, dataTables: (data||[]).content||[], totalDataTables: (data||[]).totalElements||0 })
},
error: () => {
this.setState({ loadingDataTable: false });
}
});
})
......@@ -179,6 +191,9 @@ class ImportMetadata extends React.Component {
},
callback: data => {
this.setState({ loadingDataFiled: false, dataFileds: data||[] })
},
error: () => {
this.setState({ loadingDataFiled: false });
}
});
})
......
......@@ -83,6 +83,9 @@ const ImportModal = (props) => {
setConfirmLoading(false);
setHints(data||[]);
setStep(step+1);
},
error: () => {
setConfirmLoading(false);
}
})
}
......@@ -123,8 +126,14 @@ const ImportModal = (props) => {
setConfirmLoading(false);
reset();
onCancel && onCancel(true);
},
error: () => {
setConfirmLoading(false);
}
})
},
error: () => {
setConfirmLoading(false);
}
})
......@@ -231,6 +240,7 @@ const ImportModal = (props) => {
return (
<Modal
forceRender
visible={visible}
title={title}
width={1000}
......
......@@ -65,6 +65,9 @@ const ModelTree = (props) => {
itemRef.current = firstItem;
onSelect && onSelect(firstItem?(firstItem.key||''):'');
},
error: () => {
setLoading(false);
}
})
}
......
......@@ -138,6 +138,9 @@ const UpdateTreeItemModal = (props) => {
if (onOk) {
onOk(type==='add'?item:payload);
}
},
error: () => {
setConfirmLoading(false);
}
});
} catch (errInfo) {
......
......@@ -43,6 +43,9 @@ class Model extends React.Component {
},
callback: data => {
this.setState({ loadingTableData: false, tableData: data.easyDataModelerDataModels||[] });
},
error: () => {
this.setState({ loadingTableData: false });
}
})
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment