Ensure labels of a task get updated when updating them

This commit is contained in:
kolaente 2020-03-02 22:25:38 +01:00
parent f690a6f457
commit aeba5651af
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 7 additions and 5 deletions

View file

@ -150,7 +150,7 @@
</span>
Labels
</div>
<edit-labels :task-i-d="taskID" :start-labels="task.labels" ref="labels"/>
<edit-labels :task-i-d="taskID" v-model="task.labels" ref="labels"/>
</div>
<!-- Description -->

View file

@ -121,7 +121,7 @@
<div class="field">
<label class="label">Labels</label>
<div class="control">
<edit-labels :task-i-d="taskEditTask.id" :start-labels="taskEditTask.labels"/>
<edit-labels :task-i-d="taskEditTask.id" v-model="taskEditTask.labels"/>
</div>
</div>

View file

@ -46,7 +46,7 @@
export default {
name: 'edit-labels',
props: {
startLabels: {
value: {
default: () => [],
type: Array,
},
@ -69,14 +69,14 @@
multiselect,
},
watch: {
startLabels(newLabels) {
value(newLabels) {
this.labels = newLabels
}
},
created() {
this.labelService = new LabelService()
this.labelTaskService = new LabelTaskService()
this.labels = this.startLabels
this.labels = this.value
},
methods: {
findLabel(query) {
@ -112,6 +112,7 @@
this.labelTaskService.create(labelTask)
.then(() => {
this.success({message: 'The label was successfully added.'}, this)
this.$emit('input', this.labels)
})
.catch(e => {
this.error(e, this)
@ -128,6 +129,7 @@
}
}
this.success({message: 'The label was successfully removed.'}, this)
this.$emit('input', this.labels)
})
.catch(e => {
this.error(e, this)