fix: api request 如果非200正常请求,无法显示body信息 and 优化接口编辑页面交互

This commit is contained in:
suxiaoxin 2017-11-21 20:36:34 +08:00
parent 4c6e8b8b4d
commit d3bcc4d4ce

View File

@ -248,6 +248,7 @@ class InterfaceColContent extends Component {
}
}
try {
let data = await this.crossRequest({
url: href,
@ -307,15 +308,16 @@ class InterfaceColContent extends Component {
crossRequest = (options) => {
return new Promise((resolve, reject) => {
options.success = function (res, header, data) {
options.error = options.success = function (res, header, data) {
if(isNaN(data.res.status)){
reject({
err: res,
header
})
}
resolve(data);
}
options.error = function (err, header) {
reject({
err,
header
})
}
window.crossRequest(options);
})
}
@ -687,6 +689,7 @@ class InterfaceColContent extends Component {
visible={this.state.advVisible}
onCancel={this.handleAdvCancel}
onOk={this.handleAdvOk}
maskClosable={false}
>
<h3>
是否开启:&nbsp;