#1472: Implement addLabelToBoardAndCard to also create Labels from the CardSidebar

Signed-off-by: Felix Schnabel <f.schnabel@tum.de>
This commit is contained in:
fschn
2022-11-28 17:40:02 +01:00
committed by Julius Härtl
parent d3cad6adf0
commit 6ed19bd2b0
3 changed files with 26 additions and 4 deletions

View File

@@ -273,7 +273,6 @@ export default new Vuex.Store({
labelToUpdate.color = newLabel.color
},
addLabelToCurrentBoard(state, newLabel) {
state.currentBoard.labels.push(newLabel)
},
@@ -465,6 +464,16 @@ export default new Vuex.Store({
commit('addLabelToCurrentBoard', newLabel)
})
},
async addLabelToCurrentBoardAndCard({ dispatch, commit }, { newLabel, card }) {
newLabel.boardId = this.state.currentBoard.id
const label = await apiClient.createLabel(newLabel)
commit('addLabelToCurrentBoard', label)
dispatch('addLabel', {
card,
labelId: label.id,
})
return label
},
// acl actions
async addAclToCurrentBoard({ dispatch, commit }, newAcl) {