Bug fix: if no local storage, this.user = false
[unfold.git] / portal / static / js / myslice.js
index 2f86655..d9593af 100644 (file)
@@ -106,7 +106,11 @@ var myslice = {
        user: function() {
                if ($.isEmptyObject(this.user)) {
                        //this.login(function() { return this.user; });
-                       this.user = JSON.parse(localStorage.getItem('user'));
+            if(localStorage.getItem('user')!='undefined'){
+                           this.user = JSON.parse(localStorage.getItem('user'));
+            }else{
+                return false;
+            }
                }
                return this.user;
        },