Move all caching to helper

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2022-05-06 11:32:59 +02:00
committed by backportbot-nextcloud[bot]
parent 33913be41f
commit 6a790154c2
7 changed files with 111 additions and 223 deletions

View File

@@ -84,6 +84,7 @@ export default {
async fetchAttachments({ commit }, cardId) {
const attachments = await apiClient.fetchAttachments(cardId)
commit('createAttachments', { cardId, attachments })
commit('cardSetAttachmentCount', { cardId, count: attachments.length })
},
async createAttachment({ commit }, { cardId, formData, onUploadProgress }) {

View File

@@ -252,6 +252,12 @@ export default {
}
Vue.set(state.cards[existingIndex], 'lastModified', Date.now() / 1000)
},
cardSetAttachmentCount(state, { cardId, count }) {
const existingIndex = state.cards.findIndex(_card => _card.id === cardId)
if (existingIndex !== -1) {
Vue.set(state.cards[existingIndex], 'attachmentCount', count)
}
},
cardIncreaseAttachmentCount(state, cardId) {
const existingIndex = state.cards.findIndex(_card => _card.id === cardId)
if (existingIndex !== -1) {