Created
February 10, 2014 16:41
-
-
Save jrhe/8919431 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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