update node opening/closing

This commit is contained in:
axolotle
2021-06-22 16:16:25 +02:00
parent 5d8cd184dc
commit 5ab6e19cde
7 changed files with 32 additions and 16 deletions
+2 -2
View File
@@ -132,14 +132,14 @@ export default {
router.push({ query })
},
async 'OPEN_NODE' ({ state, commit, dispatch }, [parentId, childId]) {
async 'OPEN_NODE' ({ state, commit, dispatch }, { parentId, childId }) {
const stack = state.nodebook.find(stack => stack[0] === parentId)
if (stack && (childId === undefined || stack.includes(childId))) return
commit('ADD_NODEBOOK_NODE', [stack, parentId, childId])
dispatch('UPDATE_QUERY_NODES')
},
'CLOSE_NODE' ({ state, commit, dispatch }, [parentId, childId]) {
'CLOSE_NODE' ({ state, commit, dispatch }, { parentId, childId }) {
const stack = state.nodebook.find(stack => stack.includes(parentId) && (childId ? stack.includes(childId) : true))
commit('REMOVE_NODEBOOK_NODE', [stack, childId || parentId])
dispatch('UPDATE_QUERY_NODES')