clone board func with labels and stacks

Signed-off-by: Jakob <jakob.roehrl@web.de>
This commit is contained in:
Jakob
2019-09-06 09:32:52 +02:00
parent cba7525951
commit 36afac9eff
6 changed files with 98 additions and 0 deletions

View File

@@ -115,6 +115,19 @@ export default new Vuex.Store({
state.boards.push(board)
}
},
cloneBoard(state, board) {
const indexExisting = state.boards.findIndex((b) => {
return board.id === b.id
})
if (indexExisting > -1) {
Vue.set(state.boards, indexExisting, board)
} else {
state.boards.push(board)
}
},
/**
* Removes the board from the store.
*
@@ -267,6 +280,12 @@ export default new Vuex.Store({
commit('addBoard', board)
})
},
cloneBoard({ commit }, boardData) {
apiClient.cloneBoard(boardData)
.then((board) => {
commit('cloneBoard', board)
})
},
removeBoard({ commit }, board) {
commit('removeBoard', board)
},