Skip to content

Instantly share code, notes, and snippets.

@zacharyblank
Created January 30, 2014 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zacharyblank/8707529 to your computer and use it in GitHub Desktop.
Save zacharyblank/8707529 to your computer and use it in GitHub Desktop.
Resolve this in your private routes
'use strict'
define([], function () {
function getCurrentUser() {
function loader($q, $http, config) {
var defer = $q.defer();
$http.get(config.api + '/me', { authentication:true }).then(function(user) {
defer.resolve(user);
}, function(data) {
defer.resolve(null);
});
return defer.promise;
}
loader.$inject = ['$q', '$http', 'config'];
return loader;
}
return getCurrentUser();
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment