Skip to content

Instantly share code, notes, and snippets.

@jrhe
Last active August 29, 2015 14:28
Show Gist options
  • Save jrhe/5dffa6dd8bd0f24de20b to your computer and use it in GitHub Desktop.
Save jrhe/5dffa6dd8bd0f24de20b to your computer and use it in GitHub Desktop.
import Ember from 'ember';
import Notify from 'ember-notify';
import Session from 'ember-simple-auth/services/session'
const {
Service,
computed,
isEmpty
} = Ember;
const {
service
} = Ember.inject;
export default Session.extend({
edStore: Ember.inject.service('store'),
// Customize the session so that it provides access to the user object.
user: computed('data.secure.user_id', function() {
var userId = this.get('data.secure.user_id');
if (isEmpty(userId)) {
Notify.warning('Could not fetch the user from the server. Please refresh the browser');
return;
}
return this.get('edStore').find('user', userId);
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment