Fixup for find_polls with empty localstorage

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2018-04-18 13:33:38 +02:00
parent 1a3081b58d
commit 2627dc2ae6
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -130,8 +130,18 @@
};
},
created() {
this.polls = JSON.parse(localStorage.getItem('polls'));
this.adminPolls = JSON.parse(localStorage.getItem('admin_polls'));
var polls = localStorage.getItem('polls');
if (polls === null) {
this.polls = [];
} else {
this.polls = JSON.parse(polls);
}
var adminPolls = localStorage.getItem('admin_polls');
if (adminPolls === null) {
this.adminPolls = [];
} else {
this.adminPolls = JSON.parse(adminPolls);
}
},
filters: {
date: function(value) {