feat: watch taskId instead of whole route (#812)
Co-authored-by: Dominik Pschenitschni <mail@celement.de> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/812 Reviewed-by: konrad <k@knt.li> Co-authored-by: dpschen <dpschen@noreply.kolaente.de> Co-committed-by: dpschen <dpschen@noreply.kolaente.de>
This commit is contained in:
parent
c3b6e13009
commit
64abb1ce37
1 changed files with 11 additions and 6 deletions
|
@ -471,7 +471,6 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
taskId: Number(this.$route.params.id),
|
|
||||||
taskService: new TaskService(),
|
taskService: new TaskService(),
|
||||||
task: new TaskModel(),
|
task: new TaskModel(),
|
||||||
relationKinds: relationKinds,
|
relationKinds: relationKinds,
|
||||||
|
@ -507,13 +506,16 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route': {
|
taskId: {
|
||||||
handler: 'loadTask',
|
handler: 'loadTask',
|
||||||
deep: true,
|
|
||||||
immediate: true,
|
immediate: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
taskId() {
|
||||||
|
const { id } = this.$route.params
|
||||||
|
return id === undefined ? id : Number(id)
|
||||||
|
},
|
||||||
currentList() {
|
currentList() {
|
||||||
return this.$store.state[CURRENT_LIST]
|
return this.$store.state[CURRENT_LIST]
|
||||||
},
|
},
|
||||||
|
@ -557,9 +559,12 @@ export default {
|
||||||
return uploadFile(this.taskId, ...args)
|
return uploadFile(this.taskId, ...args)
|
||||||
},
|
},
|
||||||
|
|
||||||
loadTask() {
|
loadTask(taskId) {
|
||||||
this.taskId = Number(this.$route.params.id)
|
if (taskId === undefined) {
|
||||||
this.taskService.get({id: this.taskId})
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.taskService.get({id: taskId})
|
||||||
.then(r => {
|
.then(r => {
|
||||||
this.$set(this, 'task', r)
|
this.$set(this, 'task', r)
|
||||||
this.$store.commit('attachments/set', r.attachments)
|
this.$store.commit('attachments/set', r.attachments)
|
||||||
|
|
Loading…
Reference in a new issue