fix: interfaceContent bug

This commit is contained in:
sean 2017-08-18 12:07:14 +08:00
parent 2c9a57b357
commit 9bec5d6bb4
3 changed files with 7 additions and 8 deletions

View File

@ -71,7 +71,7 @@ class Interface extends Component {
<div className="right-content">
<Switch>
<Route exact path="/project/:id/interface/:action" component={InterfaceRoute} />
<Route path="/project/:id/interface/:action/:actionId" component={InterfaceRoute} />
<Route exact path="/project/:id/interface/:action/:actionId" component={InterfaceRoute} />
</Switch>
</div>
</Col>

View File

@ -48,15 +48,13 @@ class Content extends Component {
handleRequest(nextProps) {
let matchParams = nextProps.match.params;
let _actionId;
_actionId = matchParams.actionId || 0;
if (_actionId === 0 && (nextProps.list.length > 0)) {
if (!matchParams.actionId && (nextProps.list.length > 0)) {
return this.props.history.replace('/project/' + matchParams.id + '/interface/api/' + nextProps.list[0]._id)
}
if (!nextProps.curdata) return;
if (this._actionId !== _actionId) {
this._actionId = _actionId;
this.props.fetchInterfaceData(_actionId)
if (matchParams.actionId && this._actionId !== matchParams.actionId) {
this._actionId = matchParams.actionId;
this.props.fetchInterfaceData(matchParams.actionId)
}
this.setState({
curtab: 'view'

View File

@ -193,6 +193,7 @@ class View extends Component {
render () {
const dataSource = [];
console.log(this.props.curData)
if(this.props.curData.req_headers&&this.props.curData.req_headers.length){
this.props.curData.req_headers.map((item,i)=>{
dataSource.push({