如何覆盖routeIfAlreadyAuthenticated
?
一旦发生这种情况,它如何转换到具有动态路段的路线?
我意识到我可以覆盖sessionAuthenticated
;并以这种方式覆盖routeAfterAuthentication
的功能。但是,routeIfAlreadyAuthenticated
是一个计算属性,在 unauthenticated-route-mixin.js
mixin 的 beforeModel
中执行。
任何帮助将不胜感激。
最佳答案
在 app/session/route.js
中,只需执行以下操作:
import Ember from 'ember';
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';
export default Ember.Route.extend(UnauthenticatedRouteMixin, {
routeIfAlreadyAuthenticated: 'dashboard'
});
它可以工作了,仅此而已:
Error while processing route: session.login Assertion Failed: The route index was not found Error
以下内容也有效,但已弃用
在config/environment.js
中:
var ENV = {
...
};
ENV['ember-simple-auth'] = {
// authenticationRoute: 'login',
// routeAfterAuthentication: 'dashboard',
routeIfAlreadyAuthenticated: 'dashboard'
};
关于javascript - Ember ember-simple-auth 覆盖应用程序路由中的routeIfAlreadyAuthenticated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39157042/