没有为 Ember-Simple-Auth 问题(或错误)配置授权方

No authorizer was configured for Ember-Simple-Auth issue (or bug)

按照 Ember-Simple-Auth-Devise 安装指南进行操作后,我在控制台上看到以下通知:

No authorizer was configured for Ember Simple Auth - specify one if backend requests need to be authorized. simple-auth.amd.js:1339

但是,我确实有环境的授权者,这让我想知道罪魁祸首是否是我放置代码的地方......另外,Ember 端的 Login/Logout 正在工作没有任何问题。

指南中的原始语法:

//config/environment.js
ENV['simple-auth'] = {
  authorizer: 'simple-auth-authorizer:devise'
}

我的项目环境文件:

/* jshint node: true */

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'frontend',
    environment: environment,
    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
    }
  };

  if (environment === 'simple-auth') {
   authorizer: 'simple-auth-authorizer:devise'
   store: 'simple-auth-session-store:local-storage'
  }

  if (environment === 'development') {
    // ENV.APP.LOG_RESOLVER = true;
    // ENV.APP.LOG_ACTIVE_GENERATION = true;
    // ENV.APP.LOG_TRANSITIONS = true;
    // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
    // ENV.APP.LOG_VIEW_LOOKUPS = true;
  }

  if (environment === 'test') {
    // Testem prefers this...
    ENV.baseURL = '/';
    ENV.locationType = 'none';

    // keep test console output quieter
    ENV.APP.LOG_ACTIVE_GENERATION = false;
    ENV.APP.LOG_VIEW_LOOKUPS = false;

    ENV.APP.rootElement = '#ember-testing';
  }

  if (environment === 'production') {

  }

  return ENV;
};

版本信息:

DEBUG: Ember : 1.12.0

DEBUG: Ember Data : 1.0.0-beta.18

DEBUG: jQuery : 1.11.3

DEBUG: Ember Simple Auth : 0.8.0

DEBUG: Ember Simple Auth Devise : 0.8.0

代码放置是问题所在,因为我之前误解了指南...通过在 return ENV 之前添加原始语法,问题已得到解决。这是我的环境文件现在的样子:

...
      if (environment === 'production') {

      }

ENV['simple-auth'] = {
  authorizer: 'simple-auth-authorizer:devise'
}
  return ENV;
};