Created
January 30, 2014 12:36
-
-
Save zacharyblank/8707529 to your computer and use it in GitHub Desktop.
Resolve this in your private routes
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
'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