Skip to content

Instantly share code, notes, and snippets.

@Keeo
Last active October 4, 2015 17:52
Show Gist options
  • Save Keeo/8c688f5e131b32cdb6c0 to your computer and use it in GitHub Desktop.
Save Keeo/8c688f5e131b32cdb6c0 to your computer and use it in GitHub Desktop.
//app/sessions/application
import Session from 'simple-auth/session';
import Ember from 'ember';
const { computed } = Ember;
const { service } = Ember.inject;
export default Session.extend({
store: service(),
user: computed('secure.userId', function(){
return this.get('store').findRecord('user', this.get('secure.userId'));
})
});
//config/environment.js
'simple-auth': {
session: 'session:application'
}
@NullVoxPopuli
Copy link

this gave me an error:

Uncaught Error: Attempting to inject an unknown injection: service:store

on this line:

  var session = container.lookup(Configuration.session);

in simple-auth.amd.js

@Keeo
Copy link
Author

Keeo commented Oct 4, 2015

@NullVoxPopuli
Copy link

I do use ember-cli.

here are my versions of things:

"ember": "1.13.10",
"ember-cli": "1.13.8",
"ember-simple-auth": "0.8.0",
"ember-data": "1.13",

@NullVoxPopuli
Copy link

if this is an ember 2 thing, I can finish up getting rid of my deprecation warnings and upgrade

@Keeo
Copy link
Author

Keeo commented Oct 4, 2015

Its not, it should work with 1.13.x.
I am wondering if problem is with store: service(), or with session itself.
If error persists when you comment out this then there must be wrong something like file name, or configuration. Also check that your session is in app/sessions/application.js

//config/environment.js
module.exports = function (environment) {
  var ENV = {
    'simple-auth': {
      session: 'session:application',
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment