forked from vikunja/frontend
0376ef53e3
Co-authored-by: Dominik Pschenitschni <mail@celement.de> Reviewed-on: vikunja/frontend#725 Co-authored-by: dpschen <dpschen@noreply.kolaente.de> Co-committed-by: dpschen <dpschen@noreply.kolaente.de>
25 lines
597 B
JavaScript
25 lines
597 B
JavaScript
import Vue from 'vue'
|
|
|
|
import {findIndexById} from '@/helpers/find'
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: () => ({
|
|
attachments: [],
|
|
}),
|
|
mutations: {
|
|
set(state, attachments) {
|
|
console.debug('Set attachments', attachments)
|
|
Vue.set(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)
|
|
},
|
|
},
|
|
} |