frontend/src/store/modules/attachments.js
Dominik Pschenitschni 3a7a4bdc42
Merge branch 'main' into vue3
# Conflicts:
#	src/components/input/editor.vue
#	src/components/list/partials/filters.vue
#	src/components/tasks/partials/editAssignees.vue
#	src/helpers/find.ts
#	src/helpers/time/formatDate.js
#	src/main.ts
#	src/store/modules/attachments.js
#	src/store/modules/kanban.js
#	src/views/list/views/List.vue
#	yarn.lock
2021-10-07 12:20:52 +02:00

23 lines
564 B
JavaScript

import {findIndexById} from '@/helpers/utils'
export default {
namespaced: true,
state: () => ({
attachments: [],
}),
mutations: {
set(state, attachments) {
console.debug('Set attachments', attachments)
state.attachments = attachments
},
add(state, attachment) {
console.debug('Add attachement', attachment)
state.attachments.push(attachment)
},
removeById(state, id) {
const attachmentIndex = findIndexById(state.attachments, id)
state.attachments.splice(attachmentIndex, 1)
console.debug('Remove attachement', id)
},
},
}