Created
September 25, 2014 21:45
-
-
Save Ollo/8da61cb2e450528dbc6a to your computer and use it in GitHub Desktop.
makes auth token global
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
// session-service.js | |
this.setAuth = function(token) { | |
if (!!token && !localStorage.getItem('Token')) { | |
setTokenToLocalStore(token); | |
} | |
$http.defaults.headers.common.Authorization = token ? "Token " + token : localStorage.getItem("Token"); | |
} | |
// app-controller.js | |
// set ze token | |
sessionService.setAuth(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment