From 010da8cf07ac49d6b81c372822fcf1eb207adb88 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 1 May 2020 11:50:12 +0200 Subject: [PATCH] Fix listId not changing when switching between lists --- src/components/lists/views/Kanban.vue | 13 +++++-------- src/components/lists/views/List.vue | 3 +-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/components/lists/views/Kanban.vue b/src/components/lists/views/Kanban.vue index a9538471..8dd4ae81 100644 --- a/src/components/lists/views/Kanban.vue +++ b/src/components/lists/views/Kanban.vue @@ -214,9 +214,6 @@ buckets: [], taskService: TaskService, - // We're directly using the list id from the route since that one is always available - listId: this.$route.params.listId, - dropPlaceholderOptions: { className: 'drop-preview', animationDuration: 150, @@ -245,7 +242,7 @@ }, methods: { loadBuckets() { - this.bucketService.getAll({listId: this.listId}) + this.bucketService.getAll({listId: this.$route.params.listId}) .then(r => { this.buckets = r }) @@ -358,7 +355,7 @@ const bi = bucketIndex() - const task = new TaskModel({text: this.newTaskText, bucketId: this.buckets[bi].id, listId: this.listId}) + const task = new TaskModel({text: this.newTaskText, bucketId: this.buckets[bi].id, listId: this.$route.params.listId}) this.taskService.create(task) .then(r => { @@ -375,7 +372,7 @@ return } - const newBucket = new BucketModel({title: this.newBucketTitle, listId: parseInt(this.listId)}) + const newBucket = new BucketModel({title: this.newBucketTitle, listId: parseInt(this.$route.params.listId)}) this.bucketService.create(newBucket) .then(r => { @@ -403,7 +400,7 @@ deleteBucket() { const bucket = new BucketModel({ id: this.bucketToDelete, - listId: this.listId, + listId: this.$route.params.listId, }) this.bucketService.delete(bucket) .then(r => { @@ -422,7 +419,7 @@ const bucket = new BucketModel({ id: bucketId, title: bucketTitle, - listId: Number(this.listId), + listId: Number(this.$route.params.listId), }) // Because the contenteditable does not have a change event, diff --git a/src/components/lists/views/List.vue b/src/components/lists/views/List.vue index 44678624..a2d605b9 100644 --- a/src/components/lists/views/List.vue +++ b/src/components/lists/views/List.vue @@ -118,7 +118,6 @@ name: 'List', data() { return { - listId: this.$route.params.listId, taskService: TaskService, list: {}, isTaskEdit: false, @@ -152,7 +151,7 @@ } this.showError = false - let task = new TaskModel({text: this.newTaskText, listId: this.listId}) + let task = new TaskModel({text: this.newTaskText, listId: this.$route.params.listId}) this.taskService.create(task) .then(r => { this.tasks.push(r)