Created
May 20, 2015 21:46
-
-
Save colinhoernig/59a0ff34539ea0cfc118 to your computer and use it in GitHub Desktop.
Custom Session Init for ember-simple-auth
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
import Ember from 'ember'; | |
import Session from 'simple-auth/session'; | |
var sessionWithUser = Session.extend({ | |
user: function() { | |
var userId = this.get('user_id'); | |
if (!Ember.isEmpty(userId)) { | |
return this.container.lookup('store:main').find('user', userId); | |
} | |
}.property('user_id') | |
}); | |
export | |
default { | |
name: 'customize-session', | |
before: 'simple-auth', | |
initialize: function(container) { | |
container.register('session:custom', sessionWithUser); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment