From 830c5ef07519abff3484d9893b62d05d7e9c4848 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 25 Dec 2018 23:48:32 +0100 Subject: [PATCH] Fixed "data is null" when showing tasks when there wouldn't exist any --- src/components/lists/ShowTasks.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/lists/ShowTasks.vue b/src/components/lists/ShowTasks.vue index 5ecfc8a2..ddbe6f67 100644 --- a/src/components/lists/ShowTasks.vue +++ b/src/components/lists/ShowTasks.vue @@ -62,12 +62,14 @@ HTTP.get(url, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}}) .then(response => { // Filter all done tasks - for (const index in response.data) { - if (response.data[index].done !== true) { - this.hasUndoneTasks = true + if (response.data !== null) { + for (const index in response.data) { + if (response.data[index].done !== true) { + this.hasUndoneTasks = true + } } + response.data.sort(this.sortyByDeadline) } - response.data.sort(this.sortyByDeadline) this.$set(this, 'tasks', response.data) cancel() })