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> </span>
Labels Labels
</div> </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> </div>
<!-- Description --> <!-- Description -->

View file

@ -121,7 +121,7 @@
<div class="field"> <div class="field">
<label class="label">Labels</label> <label class="label">Labels</label>
<div class="control"> <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>
</div> </div>

View file

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