如果已经过身份验证,则重定向 - ember simple auth

时间:2018-05-17 13:57:17

标签: javascript ember.js

我已为我的Ember应用程序注册和登录工作但由于某种原因'routeIfAlreadyAuthenticated'目前无效。这是我的设置:

config/environment.js

'ember-simple-auth': {
  authenticationRoute: 'auth.login',
  routeIfAlreadyAuthenticated: 'rows',
  routeAfterAuthentication: 'rows'
}

但如果我在登录后说/auth/login,则不会将我重定向到rows路线。有人知道我做错了什么吗?

1 个答案:

答案 0 :(得分:3)

您的登录路线应该延伸unauthenticated-route-mixin mixin:

import Route from '@ember/routing/route';
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';

export default Route.extend(UnauthenticatedRouteMixin, {
});
相关问题