Torii没有注入'会话' EmberJS 2.0

时间:2015-09-02 17:49:39

标签: ember.js

我一直收到没有定义会话var的错误。我已经在这里查看了有关重新启动余烬服务以解除任何缓存问题的其他答案,但我已经多次尝试过,并且我已经遵循了该信件的咒语指南。有谁知道会出现什么问题?身份验证成功但会话未绑定。这是我的文件:

/app/routes/application.js

import Ember from 'ember';

export default Ember.Route.extend({
  model: function() {
    return this.store.query('post', {
      orderBy: 'timestamp',
      limitToLast: 3
    });
  },
  actions: {
    authenticate: function(username, pass) {
      this.get('session').open('firebase', {
        provider: "password",
        email: username,
        password: pass
      }).then(function (data) {
        console.log(data.currentUser);
        console.log(session);
      });
    }
  }
});

/应用/鸟居的适配器

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

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

/config/environment.js

var ENV = {
    modulePrefix: 'website',
    environment: environment,
    contentSecurityPolicy: { 'connect-src': "'self' https://auth.firebase.com wss://*.firebaseio.com" },
    firebase: 'https://REMOVED.firebaseio.com/',
    torii: {
      sessionServiceName: 'session'
    },
    baseURL: '/',
    locationType: 'auto',
    EmberENV: {
      FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
      }
    },

    APP: {
      // Here you can pass flags/options to your application instance
      // when it is created
    }
  };

1 个答案:

答案 0 :(得分:1)

我在emberfire教程之后遇到了同样的问题。我通过npm:

显式安装torii解决了这个问题
npm install torii

重新启动服务器,一切顺利。