Skip to content

Commit

Permalink
fix: 二级分类也显示在一级bug/接口列表 分类有时候只显示id的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
czyzeyong committed Nov 11, 2020
1 parent 5f7067a commit 20b2989
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ class InterfaceMenu extends Component {

async getList() {
let r = await this.props.fetchInterfaceListMenu(this.props.projectId);
r.payload.data.data.forEach(item => {
item.parent_id = item.parent_id || 0
})
this.setState({
list: r.payload.data.data
});
Expand Down Expand Up @@ -676,7 +673,7 @@ class InterfaceMenu extends Component {
return a.index - b.index;//从小到大排序
});
});
const resultArray = temp.sort((a, b) => {
const resultArray = temp.filter(f => f.parent_id == 0).sort((a, b) => {
return a.index - b.index;//从小到大排序
});

Expand Down
3 changes: 3 additions & 0 deletions client/reducer/modules/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ export async function fetchInterfaceData(interfaceId) {

export async function fetchInterfaceListMenu(projectId) {
let result = await axios.get('/api/interface/list_menu?project_id=' + projectId);
result.data.data.forEach(item => {
item.parent_id = item.parent_id || 0
})
return {
type: FETCH_INTERFACE_LIST_MENU,
payload: result
Expand Down

0 comments on commit 20b2989

Please sign in to comment.