Last active
August 29, 2015 14:28
-
-
Save jrhe/5dffa6dd8bd0f24de20b to your computer and use it in GitHub Desktop.
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
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