new functions

Signed-off-by: Jakob <jakob.roehrl@web.de>
This commit is contained in:
Jakob
2019-07-24 08:08:46 +02:00
committed by Julius Härtl
parent 38dc7945dd
commit 4a45687a28
9 changed files with 226 additions and 55 deletions

View File

@@ -62,20 +62,30 @@ export default {
state.cards[existingIndex].title = card.title
}
},
assignCardToMe(state, card) {
console.log(card)
assignCardToUser(state, card) {
// let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
/* if (existingIndex !== -1) {
} */
},
updateCard(state, card) {
// console.log(card)
// new card is not returned!
// let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
/* if (existingIndex !== -1) {
state.cards[existingIndex] = card
} */
updateCardDesc(state, card) {
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
if (existingIndex !== -1) {
state.cards[existingIndex].description = card.description
}
},
updateCardDue(state, card) {
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
if (existingIndex !== -1) {
state.cards[existingIndex].duedate = card.duedate
}
},
updateCardLabels(state, card) {
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
if (existingIndex !== -1) {
let existingCard = state.cards.find(_card => _card.id === card.id)
existingCard.labels = card.labels
}
}
},
actions: {
@@ -108,17 +118,41 @@ export default {
commit('deleteCard', card)
})
},
assignCardToMe({ commit }, card) {
assignCardToUser({ commit }, card) {
apiClient.assignUser(card)
.then((card) => {
commit('assignCardToMe', card)
.then(() => {
commit('assignCardToUser')
})
},
assignLabel({ commit }, data) {
addLabel({ commit }, data) {
apiClient.assignLabelToCard(data)
.then(() => {
commit('updateCardLabels', data.card)
})
},
removeLabel({ commit }, data) {
apiClient.removeLabelFromCard(data)
.then(() => {
commit('updateCardLabels', data.card)
})
},
cardUndoDelete({ commit }, card) {
apiClient.updateCard(card)
.then((card) => {
commit('updateCard', card)
})
},
updateCardDesc({ commit }, card) {
apiClient.updateCard(card)
.then((updatedCard) => {
commit('updateCardDesc', updatedCard)
})
},
updateCardDue({ commit }, card) {
apiClient.updateCard(card)
.then((card) => {
commit('updateCardDue', card)
})
}
}
}

View File

@@ -262,7 +262,6 @@ export default new Vuex.Store({
params.append('itemType', 0)
params.append('itemType', 1)
axios.get(OC.linkToOCS('apps/files_sharing/api/v1') + 'sharees', { params }).then((response) => {
// commit('setSharees', response.data.ocs.data.users)
commit('setSharees', response.data.ocs.data)
})
},

View File

@@ -68,7 +68,7 @@ export default {
}
},
setDeletedStacks(state, delStacks) {
state.deletedStacks.push(delStacks)
state.deletedStacks.push(delStacks[0])
},
setDeletedCards(state, delCards) {
state.deletedCards.push(delCards)
@@ -130,6 +130,13 @@ export default {
.then((deletedCards) => {
commit('setDeletedCards', deletedCards)
})
},
stackUndoDelete({ commit }, stack) {
apiClient.updateStack(stack)
.then((stack) => {
commit('addStack', stack)
})
}
}
}