Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
frontend-auth
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
f60f61a3
authored
2017-05-17 14:40:12 -0500
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Switch from $.cookie to js-cookie.
1 parent
21af861a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
package.json
src/scripts/Auth.js
package.json
View file @
f60f61a
...
...
@@ -3,6 +3,7 @@
"version"
:
"2016.12.01-0"
,
"main"
:
"src/scripts/Auth.js"
,
"dependencies"
:
{
"js-cookie"
:
""
,
"backbone"
:
""
,
"requirejs"
:
""
},
...
...
src/scripts/Auth.js
View file @
f60f61a
...
...
@@ -3,6 +3,7 @@ define(function(require) {
var
$
=
require
(
'jquery'
);
var
_
=
require
(
'underscore'
);
var
Backbone
=
require
(
'backbone'
);
var
cookie
=
require
(
'js-cookie'
);
function
bindMethods
()
{
var
args
=
_
.
toArray
(
arguments
);
...
...
@@ -156,16 +157,16 @@ define(function(require) {
}
var
sessionId
=
self
.
get
(
'sessionId'
);
if
(
sessionId
)
{
$
.
cookie
(
cookieName
,
sessionId
);
cookie
.
set
(
cookieName
,
sessionId
);
}
else
{
self
.
set
(
'sessionId'
,
$
.
cookie
(
cookieName
));
self
.
set
(
'sessionId'
,
cookie
.
get
(
cookieName
));
}
self
.
on
(
'change:sessionId'
,
function
()
{
var
sessionId
=
this
.
get
(
'sessionId'
);
if
(
sessionId
)
{
$
.
cookie
(
cookieName
,
sessionId
);
cookie
.
set
(
cookieName
,
sessionId
);
}
else
{
$
.
removeCooki
e
(
cookieName
);
cookie
.
remov
e
(
cookieName
);
}
},
self
);
})(
this
,
globalOptions
.
cookieName
);
...
...
Please
register
or
sign in
to post a comment