Merge branch 'master' into feature/options-menu

This commit is contained in:
kolaente 2021-01-28 21:24:42 +01:00
commit 2a153184d3
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 5 additions and 2 deletions

View File

@ -14,10 +14,9 @@ export default {
const attachmentModel = new AttachmentModel({taskId: this.taskId})
attachmentService.create(attachmentModel, files)
.then(r => {
console.debug(`Uploaded attachments for task ${this.taskId}, response was`, r)
if (r.success !== null) {
r.success.forEach(a => {
this.$store.commit('attachments/removeById', a.id)
this.$store.commit('attachments/add', a)
this.$store.dispatch('tasks/addTaskAttachment', {
taskId: this.taskId,
attachment: a,

View File

@ -7,15 +7,18 @@ export default {
}),
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) {
for (const a in state.attachments) {
if (state.attachments[a].id === id) {
state.attachments.splice(a, 1)
console.debug('Remove attachement', id)
break
}
}

View File

@ -41,6 +41,7 @@ export default {
addTaskAttachment(ctx, {taskId, attachment}) {
const t = ctx.rootGetters['kanban/getTaskById'](taskId)
if (t.task === null) {
ctx.commit('attachments/add', attachment, {root: true})
return
}
t.task.attachments.push(attachment)