Nir*_*osh 0 authentication ember.js
根据文档,我应该在我的config/environment.js文件中放置routeAfterAuthentication.
我的environment.js包含以下内容:
module.exports = function(environment) {
var ENV = {
modulePrefix: 'client',
environment: environment,
baseURL: '',
locationType: 'auto',
routeAfterAuthentication: 'dashboard',
...
Run Code Online (Sandbox Code Playgroud)
但是,它仍未被重定向到仪表板路由并显示未定义索引路由.
我在这里错过了什么吗?
您需要包含这样的ember-simple-auth密钥
var ENV = {
};
...
ENV['ember-simple-auth'] = {
authenticationRoute: 'sign-in',
routeAfterAuthentication: 'YOUR ROUTE GOES HERE'
}
...
Run Code Online (Sandbox Code Playgroud)
您也可以通过if(environment === 'development')中的环境定义它们,但是对于所有环境,您可以在var ENV声明之后放置它们.导入应用程序路由mixin也很重要,以便重定向工作(app / routes / application.js)
import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
export default Ember.Route.extend(ApplicationRouteMixin, {});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
186 次 |
| 最近记录: |