Skip to content

Instantly share code, notes, and snippets.

@koriroys
Created February 17, 2015 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koriroys/b6cff67ca26026834b77 to your computer and use it in GitHub Desktop.
Save koriroys/b6cff67ca26026834b77 to your computer and use it in GitHub Desktop.
// app/sessions/custom.js
import Session from 'simple-auth/session';
import Ember from 'ember';
import ENV from 'hivebench-web/config/environment';
export default Session.extend({
currentUser: null,
setCurrentUser: function() {
// http://emberjs.com/guides/models/finding-records/
// GET /users?uid=XqgfssyI447zz
this.container.lookup('store:main').find('user', { uid: authData.uid }).then(function(user) {
this.set('currentUser', users.filterBy('uid', authData.uid)[0])
}
}.observes('authData.uid')
});
// config/environment.js
if (environment === 'development') {
ENV['simple-auth'] = {
session: "session:custom"
}
}
$ ember install:addon ember-cli-simple-auth
// in a template
{{session.currentUser}}
// in a controller method
this.session.currentUser;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment