diff --git a/src/components/lists/ShowList.vue b/src/components/lists/ShowList.vue index 1320afe0..794964a3 100644 --- a/src/components/lists/ShowList.vue +++ b/src/components/lists/ShowList.vue @@ -30,7 +30,7 @@
@@ -102,11 +102,14 @@ this.loading = true - HTTP.post(`tasks/` + e.target.id, {done: !e.target.checked}, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}}) + HTTP.post(`tasks/` + e.target.id, {done: e.target.checked}, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}}) .then(response => { - // eslint-disable-next-line - console.log(response) - //this.list.tasks.push(response.data) + for (const t in this.list.tasks) { + if (this.list.tasks[t].id === response.data.id) { + this.$set(this.list.tasks, t, response.data) + break + } + } this.handleSuccess({message: 'The task was successfully marked as done.'}) }) .catch(e => {