Clone boards with stacks, labels (#1221)

Clone boards with stacks, labels
This commit is contained in:
Julius Härtl
2019-10-10 09:03:34 +02:00
committed by GitHub
8 changed files with 110 additions and 3 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.
*
@@ -268,6 +281,15 @@ export default new Vuex.Store({
commit('addBoard', board)
})
},
async cloneBoard({ commit }, boardData) {
try {
let newBoard = await apiClient.cloneBoard(boardData)
commit('cloneBoard', newBoard)
return newBoard
} catch (err) {
return err
}
},
removeBoard({ commit }, board) {
commit('removeBoard', board)
},