mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-30 13:20:24 +08:00
fix: api request 如果非200正常请求,无法显示body信息 and 优化接口编辑页面交互
This commit is contained in:
parent
4c6e8b8b4d
commit
d3bcc4d4ce
@ -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>
|
||||
是否开启:
|
||||
|
Loading…
Reference in New Issue
Block a user