update, delete and create are working
Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
This commit is contained in:
committed by
Julius Härtl
parent
b3cb618707
commit
1cd1684936
@@ -139,6 +139,7 @@ export default new Vuex.Store({
|
||||
|
||||
// label mutators
|
||||
removeLabelFromCurrentBoard(state, labelId) {
|
||||
console.log(labelId)
|
||||
const removeIndex = state.currentBoard.labels.findIndex((l) => {
|
||||
return labelId === l.id
|
||||
})
|
||||
@@ -155,6 +156,10 @@ export default new Vuex.Store({
|
||||
|
||||
labelToUpdate.title = newLabel.title
|
||||
labelToUpdate.color = newLabel.color
|
||||
},
|
||||
addLabelToCurrentBoard(state, newLabel) {
|
||||
|
||||
state.currentBoard.labels.push(newLabel)
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@@ -234,11 +239,23 @@ export default new Vuex.Store({
|
||||
},
|
||||
|
||||
// label actions
|
||||
removeLabelFromCurrentBoard({ commit }, labelId) {
|
||||
commit('removeLabelFromCurrentBoard', labelId);
|
||||
removeLabelFromCurrentBoard({ commit }, label) {
|
||||
apiClient.deleteLabel(label)
|
||||
.then((label) => {
|
||||
commit('removeLabelFromCurrentBoard', label.id);
|
||||
})
|
||||
},
|
||||
updateLabelFromCurrentBoard({ commit }, newLabel) {
|
||||
commit('updateLabelFromCurrentBoard', newLabel);
|
||||
apiClient.updateLabel(newLabel)
|
||||
.then((newLabel) => {
|
||||
commit('updateLabelFromCurrentBoard', newLabel);
|
||||
})
|
||||
},
|
||||
addLabelToCurrentBoard({ commit }, newLabel) {
|
||||
apiClient.createLabel(newLabel)
|
||||
.then((newLabel) => {
|
||||
commit('addLabelToCurrentBoard', newLabel);
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user