Manage local data loading error
This commit is contained in:
parent
b3687a77e4
commit
eaf2c8d0f4
1 changed files with 20 additions and 5 deletions
|
@ -3,11 +3,26 @@ function GroupList() {
|
||||||
lastChange=0;
|
lastChange=0;
|
||||||
|
|
||||||
this.loadFromLocalStorage=function() {
|
this.loadFromLocalStorage=function() {
|
||||||
if (localStorage.groups!==undefined) {
|
if (jQuery.type(localStorage.groups)!='undefined') {
|
||||||
var data=JSON.parse(localStorage.groups);
|
try {
|
||||||
this.lastChange=data.lastChange;
|
var data=JSON.parse(localStorage.groups);
|
||||||
for (el in data.groups) {
|
this.lastChange=data.lastChange;
|
||||||
this[el]=new Group(el,data.groups[el]);
|
for (el in data.groups) {
|
||||||
|
this[el]=new Group(el,data.groups[el]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
for (el in this) {
|
||||||
|
if (this.isGroup(this[el])) {
|
||||||
|
delete this[el];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myconfirm('Erreur en chargeant les données locales. On les purges ?',
|
||||||
|
function(data) {
|
||||||
|
delete localStorage.groups;
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue