Created
July 30, 2015 18:46
-
-
Save jcdalton2201/4ec97180d245effaf6f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
angular.module('ls2FrontEnd') | |
.factory('authTokenFactory', AuthToken); | |
AuthToken.$inject = ['$window', '$cookies']; | |
function AuthToken ($window, $cookies) { | |
var store = $window.sessionStorage; | |
var key = 'auth-token'; | |
var factory = { | |
getToken: getToken, | |
setToken: setToken | |
}; | |
return factory; | |
function getToken() { | |
return store.getItem(key); | |
} | |
function setToken(token) { | |
if(token) { | |
store.setItem(key, token); | |
} else { | |
store.removeItem(key); | |
} | |
} | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment