重定向不允许我转到其他链接
Redirect Doesn't Allow Me To Go To Other Links
我正在尝试使用以下代码进行登录重定向:
Router.onBeforeAction(function () {
if (!Meteor.user() && !Meteor.loggingIn()) {
this.next();
} else {
// required by Iron to process the route handler
this.redirect('/map');
this.next();
}
});
但是,当我登录并成功将我重定向到 /maps 时,我无法单击导航栏上的任何 link。 link 工作正常,但是,当我点击它们时,它只是将我重定向回 /map。
非常感谢您的帮助!
此外,这里是 github link:
这个怎么样:
Router.route('/login',
{ name: 'login' });
var requireLogin = function(){
if (! Meteor.user() ) {
this.redirect('login');
} else {
this.next();
}
}
Router.onBeforeAction(requireLogin, {except: ['login']});
我正在尝试使用以下代码进行登录重定向:
Router.onBeforeAction(function () {
if (!Meteor.user() && !Meteor.loggingIn()) {
this.next();
} else {
// required by Iron to process the route handler
this.redirect('/map');
this.next();
}
});
但是,当我登录并成功将我重定向到 /maps 时,我无法单击导航栏上的任何 link。 link 工作正常,但是,当我点击它们时,它只是将我重定向回 /map。
非常感谢您的帮助!
此外,这里是 github link:
这个怎么样:
Router.route('/login',
{ name: 'login' });
var requireLogin = function(){
if (! Meteor.user() ) {
this.redirect('login');
} else {
this.next();
}
}
Router.onBeforeAction(requireLogin, {except: ['login']});