简单的身份验证加载项似乎未读取环境配置 [英] Simple auth addon seems to not be reading env config

查看:87
本文介绍了简单的身份验证加载项似乎未读取环境配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循的示例此处,我将其保存在 config / environment.js 文件中:

I am following the example here, and I have this in my config/environment.js file:

ENV['simple-auth'] = {
  authorizer: 'simple-auth-authorizer:devise',
  routeAfterAuthentication: 'landing-pages'
};

但是,在我的应用进行身份验证之后,它会尝试转到索引路线。我通过在中添加断点,确认所使用的配置变量具有 index 作为 routeAfterAuthentication 属性。该库的sessionAuthenticationSucceeded 方法。

However, after my app authenticates it tries to go to the index route. I confirmed the configuration variable used had index as the routeAfterAuthentication property by adding a breakpoint in the sessionAuthenticationSucceeded method of the library.

我尝试了 import environment.js 文件为ES6样式,但这似乎不太可能。

I tried importing the configuration in the environment.js file ES6-style, but that doesn't seem possible.

推荐答案

Ember Simple Auth实际上仍然依赖 window.ENV 配置变量,因此您需要将其添加到配置中。这样做:

Ember Simple Auth actually still relies on the window.ENV configuration variable, so you'll need to add it to your configuration. Do it like this:

  window.MyAppENV = {{ENV}};
+ window.ENV = window.MyAppENV;
  window.EmberENV = window.MyAppENV.EmberENV;

这篇关于简单的身份验证加载项似乎未读取环境配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆