stack add and remove

Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
This commit is contained in:
Jakob Röhrl
2019-05-23 10:49:54 +02:00
committed by Julius Härtl
parent b8cb364f00
commit f71f24c450
9 changed files with 296 additions and 17 deletions

View File

@@ -51,6 +51,16 @@ export default {
for (let i = 0; i < newOrder.length; i++) {
newOrder[i].order = parseInt(i)
}
},
deleteStack(state, stack) {
let existingIndex = state.stacks.findIndex(_stack => _stack.id === stack.id)
console.log(existingIndex)
if (existingIndex !== -1) {
state.stacks.splice(existingIndex, 1)
}
},
updateStack(state, stack) {
}
},
actions: {
@@ -77,9 +87,22 @@ export default {
})
},
createStack({ commit }, stack) {
stack.boardId = this.state.currentBoard.id
apiClient.createStack(stack)
.then((createdStack) => {
commit('addStack', createdStack)
})
},
deleteStack({ commit }, stack) {
apiClient.deleteStack(stack.id)
.then((stack) => {
commit('addStack', stack)
commit('deleteStack', stack)
})
},
updateStack({ commit }, stack) {
apiClient.updateStack(stack)
.then((stack) => {
commit('updateStack', stack)
})
}
}