简单的身份验证加载项似乎未读取环境配置 [英] Simple auth addon seems to not be reading env config
问题描述
我遵循的示例此处,我将其保存在 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 import
ing 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屋!