gpt4 book ai didi

javascript - Ember ember-simple-auth 在应用程序路由中覆盖 routeIfAlreadyAuthenticated

转载 作者:行者123 更新时间:2023-11-29 21:16:41 24 4
gpt4 key购买 nike

如何覆盖 routeIfAlreadyAuthenticated

一旦发生这种情况,它如何过渡到具有动态路段的路线?

我意识到我可以覆盖 sessionAuthenticated;并以这种方式覆盖 routeAfterAuthentication 的功能。但是,routeIfAlreadyAuthenticated 是一个计算属性,它在 unauthenticated-route-mixin.js 混合中的 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com