Switch from $.cookie to js-cookie.
Showing
2 changed files
with
6 additions
and
4 deletions
... | @@ -3,6 +3,7 @@ | ... | @@ -3,6 +3,7 @@ |
3 | "version": "2016.12.01-0", | 3 | "version": "2016.12.01-0", |
4 | "main": "src/scripts/Auth.js", | 4 | "main": "src/scripts/Auth.js", |
5 | "dependencies": { | 5 | "dependencies": { |
6 | "js-cookie": "", | ||
6 | "backbone": "", | 7 | "backbone": "", |
7 | "requirejs": "" | 8 | "requirejs": "" |
8 | }, | 9 | }, | ... | ... |
... | @@ -3,6 +3,7 @@ define(function(require) { | ... | @@ -3,6 +3,7 @@ define(function(require) { |
3 | var $ = require('jquery'); | 3 | var $ = require('jquery'); |
4 | var _ = require('underscore'); | 4 | var _ = require('underscore'); |
5 | var Backbone = require('backbone'); | 5 | var Backbone = require('backbone'); |
6 | var cookie = require('js-cookie'); | ||
6 | 7 | ||
7 | function bindMethods() { | 8 | function bindMethods() { |
8 | var args = _.toArray(arguments); | 9 | var args = _.toArray(arguments); |
... | @@ -156,16 +157,16 @@ define(function(require) { | ... | @@ -156,16 +157,16 @@ define(function(require) { |
156 | } | 157 | } |
157 | var sessionId = self.get('sessionId'); | 158 | var sessionId = self.get('sessionId'); |
158 | if (sessionId) { | 159 | if (sessionId) { |
159 | $.cookie(cookieName, sessionId); | 160 | cookie.set(cookieName, sessionId); |
160 | } else { | 161 | } else { |
161 | self.set('sessionId', $.cookie(cookieName)); | 162 | self.set('sessionId', cookie.get(cookieName)); |
162 | } | 163 | } |
163 | self.on('change:sessionId', function() { | 164 | self.on('change:sessionId', function() { |
164 | var sessionId = this.get('sessionId'); | 165 | var sessionId = this.get('sessionId'); |
165 | if (sessionId) { | 166 | if (sessionId) { |
166 | $.cookie(cookieName, sessionId); | 167 | cookie.set(cookieName, sessionId); |
167 | } else { | 168 | } else { |
168 | $.removeCookie(cookieName); | 169 | cookie.remove(cookieName); |
169 | } | 170 | } |
170 | }, self); | 171 | }, self); |
171 | })(this, globalOptions.cookieName); | 172 | })(this, globalOptions.cookieName); | ... | ... |
-
Please register or sign in to post a comment