使用Ember Simple Auth时,如果用户试图查看他们只能在登录时才能访问的页面,如何将用户重定向到登录页面?
您只需在 Route 中导入 AuthenticatedRouteMixin
Route
AuthenticatedRouteMixin
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
并像这样使用它:
export default Ember.Route.extend(AuthenticatedRouteMixin);
这将使路由(及其所有子路由)在未对会话进行身份验证时转换为可配置的登录路由 .
更多信息here .
1 回答
您只需在
Route
中导入AuthenticatedRouteMixin
并像这样使用它:
这将使路由(及其所有子路由)在未对会话进行身份验证时转换为可配置的登录路由 .
更多信息here .