From 14f86570e346d23befb6dca4e63d44b27e2e7ecb Mon Sep 17 00:00:00 2001 From: Ciro Scognamiglio Date: Tue, 8 Apr 2014 19:25:08 +0200 Subject: [PATCH] fix --- portal/static/js/myslice.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/portal/static/js/myslice.js b/portal/static/js/myslice.js index 0807d495..2f866553 100644 --- a/portal/static/js/myslice.js +++ b/portal/static/js/myslice.js @@ -106,16 +106,19 @@ var myslice = { user: function() { if ($.isEmptyObject(this.user)) { //this.login(function() { return this.user; }); - this.user = localStorage.getItem('user'); + this.user = JSON.parse(localStorage.getItem('user')); } return this.user; }, login: function(fn) { - $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) { - myslice.user = new user(data[0]); - localStorage.setItem('user', JSON.stringify(myslice.user)); - }); + user = localStorage.getItem('user'); + if($.isEmptyObject(user)){ + $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) { + //myslice.user = new user(data[0]); + localStorage.setItem('user', JSON.stringify(data[0])); + }); + } }, getSlices: function(name) { -- 2.43.0