label update

Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
This commit is contained in:
Jakob Röhrl
2019-03-27 10:08:47 +01:00
committed by Julius Härtl
parent 96ec6b812c
commit b3cb618707
2 changed files with 27 additions and 9 deletions

View File

@@ -140,12 +140,21 @@ export default new Vuex.Store({
// label mutators
removeLabelFromCurrentBoard(state, labelId) {
const removeIndex = state.currentBoard.labels.findIndex((l) => {
return labelId !== l.id
return labelId === l.id
})
if (removeIndex > -1) {
state.currentBoard.labels.splice(removeIndex, 1)
}
},
updateLabelFromCurrentBoard(state, newLabel) {
let labelToUpdate = state.currentBoard.labels.find((l) => {
return newLabel.id === l.id
})
labelToUpdate.title = newLabel.title
labelToUpdate.color = newLabel.color
}
},
actions: {
@@ -227,6 +236,9 @@ export default new Vuex.Store({
// label actions
removeLabelFromCurrentBoard({ commit }, labelId) {
commit('removeLabelFromCurrentBoard', labelId);
}
},
updateLabelFromCurrentBoard({ commit }, newLabel) {
commit('updateLabelFromCurrentBoard', newLabel);
},
}
})
})