From 338930e1cad862f94e2d67e92af7bdfc15b8ca6f Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Fri, 3 Apr 2015 15:35:05 +0200 Subject: [PATCH] La session n'était pas retenue au démarrage --- public/js/services/SessionServ.js | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/public/js/services/SessionServ.js b/public/js/services/SessionServ.js index 5082dda..434aa5b 100644 --- a/public/js/services/SessionServ.js +++ b/public/js/services/SessionServ.js @@ -2,7 +2,6 @@ angular.module('SessionsServ', []).service('SessionServ', ['$http', 'EncryptServ function ($http, EncryptServ) { a = { cur: false, - status: 0, changeHandlers: [], onChange: function (fun) { this.changeHandlers.push(fun); @@ -22,23 +21,18 @@ angular.module('SessionsServ', []).service('SessionServ', ['$http', 'EncryptServ this.triggerChange(); }, get: function (cb) { // Fetch infos if needed - if (status === 0) { - this.status = 1; // Fetching - _this = this; - // TODO Verify if cookies to prevent uneeded request - $http.get('/api/session').success(function (body) { - _this.updateSessionInfos(body); - if (cb) { - if (this.logged) { - cb(null); - } else { - cb(body); - } + _this = this; + // TODO Verify if cookies to prevent uneeded request + $http.get('/api/session').success(function (body) { + _this.updateSessionInfos(body); + if (cb) { + if (this.logged) { + cb(null); + } else { + cb(body); } - }); - } else { - console.warn("Unnecessary get() call"); - } + } + }); }, connect: function (login, pass, cb) { _this = this; -- libgit2 0.21.2