samedi 29 août 2015

Torii session undefined - not injected in ember / firebase app

In an ember cli project using firebase, I've installed (using ember install) emberfire and torii. I have put the following configuration in my config/environment.js right after my firebase app url:

torii = {
  sessionServiceName: 'session',
}

And I've put an adapter into app/torii-adapters/application.js:

import Ember from 'ember';
import ToriiFirebaseAdapter from 'emberfire/torii-adapters/firebase';

export default ToriiFirebaseAdapter.extend({
  firebase: Ember.inject.service()
});

However, when I try to get torii's session variable on any route or controller:

this.get("session").fetch().catch(function() {});

the session is undefined:

Error while processing route: app Cannot read property 'fetch' of undefined TypeError: Cannot read property 'fetch' of undefined

I've followed the firebase docs/examples to the best of my knowledge, so I'm not sure what I'm missing. Is another step needed to have torii inject the session variable into all routes and controllers?


The versions in my stack are:

Ember-CLI: 1.13.7
Firebase (package.json): 2.2.9
EmberFire (package.json): 1.5.0
Torii (package.json): 0.5.1

NOTE: I currently have firebase itself working great—all of my models are in sync—so it is not likely the result of a faulty firebase setup. Also, this.get('session') returns undefined anywhere in any route or controller in my app.




Aucun commentaire:

Enregistrer un commentaire