From e9c15506ee5457dfa9c41080b8102625ddd5e5ce Mon Sep 17 00:00:00 2001 From: sean Date: Thu, 7 Sep 2017 15:48:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E6=8E=A5=E5=8F=A3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Interface/InterfaceList/InterfaceMenu.js | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js b/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js index d9e44965..b934164b 100644 --- a/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js +++ b/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js @@ -82,11 +82,16 @@ class InterfaceMenu extends Component { } } - async handleRequest() { + handleRequest() { this.props.initInterface() - await this.props.fetchInterfaceList(this.props.projectId); + this.getList() + } + + async getList(){ + let r = await this.props.fetchInterfaceList(this.props.projectId); + console.log(r.payload.data) this.setState({ - list: JSON.parse(JSON.stringify(this.props.list)) + list: JSON.parse(JSON.stringify(r.payload.data)) }) } @@ -119,7 +124,7 @@ class InterfaceMenu extends Component { message.success('接口添加成功') let interfaceId = res.data.data._id; this.props.history.push("/project/" + this.props.projectId + "/interface/api/" + interfaceId) - this.props.fetchInterfaceList(this.props.projectId) + this.getList() this.setState({ visible: false }); @@ -135,7 +140,7 @@ class InterfaceMenu extends Component { return message.error(res.data.errmsg); } message.success('接口分类添加成功') - this.props.fetchInterfaceList(this.props.projectId) + this.getList() this.props.getProject(data.project_id) this.setState({ add_cat_modal_visible: false @@ -156,7 +161,7 @@ class InterfaceMenu extends Component { return message.error(res.data.errmsg); } message.success('接口分类更新成功') - this.props.fetchInterfaceList(this.props.projectId) + this.getList() this.setState({ change_cat_modal_visible: false }); @@ -170,10 +175,12 @@ class InterfaceMenu extends Component { title: '您确认删除此接口', content: '温馨提示:接口删除后,无法恢复', async onOk() { + await that.props.deleteInterfaceData(id, that.props.projectId) - await that.props.fetchInterfaceList(that.props.projectId) - that.props.history.push('/project/' + that.props.match.params.id + '/interface/api') + await that.getList() ref.destroy() + that.props.history.push('/project/' + that.props.match.params.id + '/interface/api') + }, async onCancel() { ref.destroy() @@ -188,7 +195,7 @@ class InterfaceMenu extends Component { content: '温馨提示:该操作会删除该分类下所有接口,接口删除后无法恢复', async onOk() { await that.props.deleteInterfaceCatData(catid, that.props.projectId) - await that.props.fetchInterfaceList(that.props.projectId) + await that.getList() that.props.history.push('/project/' + that.props.match.params.id + '/interface/api') ref.destroy() },