Commit 338930e1cad862f94e2d67e92af7bdfc15b8ca6f
1 parent
7a1fe62d
La session n'était pas retenue au démarrage
Showing
1 changed file
with
11 additions
and
17 deletions
Show diff stats
public/js/services/SessionServ.js
... | ... | @@ -2,7 +2,6 @@ angular.module('SessionsServ', []).service('SessionServ', ['$http', 'EncryptServ |
2 | 2 | function ($http, EncryptServ) { |
3 | 3 | a = { |
4 | 4 | cur: false, |
5 | - status: 0, | |
6 | 5 | changeHandlers: [], |
7 | 6 | onChange: function (fun) { |
8 | 7 | this.changeHandlers.push(fun); |
... | ... | @@ -22,23 +21,18 @@ angular.module('SessionsServ', []).service('SessionServ', ['$http', 'EncryptServ |
22 | 21 | this.triggerChange(); |
23 | 22 | }, |
24 | 23 | get: function (cb) { // Fetch infos if needed |
25 | - if (status === 0) { | |
26 | - this.status = 1; // Fetching | |
27 | - _this = this; | |
28 | - // TODO Verify if cookies to prevent uneeded request | |
29 | - $http.get('/api/session').success(function (body) { | |
30 | - _this.updateSessionInfos(body); | |
31 | - if (cb) { | |
32 | - if (this.logged) { | |
33 | - cb(null); | |
34 | - } else { | |
35 | - cb(body); | |
36 | - } | |
24 | + _this = this; | |
25 | + // TODO Verify if cookies to prevent uneeded request | |
26 | + $http.get('/api/session').success(function (body) { | |
27 | + _this.updateSessionInfos(body); | |
28 | + if (cb) { | |
29 | + if (this.logged) { | |
30 | + cb(null); | |
31 | + } else { | |
32 | + cb(body); | |
37 | 33 | } |
38 | - }); | |
39 | - } else { | |
40 | - console.warn("Unnecessary get() call"); | |
41 | - } | |
34 | + } | |
35 | + }); | |
42 | 36 | }, |
43 | 37 | connect: function (login, pass, cb) { |
44 | 38 | _this = this; | ... | ... |