Fixed "data is null" when showing tasks when there wouldn't exist any

This commit is contained in:
kolaente 2018-12-25 23:48:32 +01:00
parent f8fb60a004
commit 830c5ef075
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -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()
})