Skip to content

Instantly share code, notes, and snippets.

@jrhe
Created February 10, 2014 16:41
Show Gist options
  • Save jrhe/8919431 to your computer and use it in GitHub Desktop.
Save jrhe/8919431 to your computer and use it in GitHub Desktop.
Ember.SimpleAuth.Session.reopen({
currentUser: function() {
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.ajax({
url: '/api/users/current',
type: 'GET'
}).then(function(response) {
Ember.run(function() {
var user = container.lookup("store:main").pushPayload(response);
resolve(user);
});
}, function(xhr, status, error) {
Ember.run(function() {
reject(xhr.responseText);
});
});
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment