0
我想阻止某些用戶輸入特定路由。對於未登錄用戶I'va看到的例子:鐵:路由器重定向不是管理員用戶
Router.onBeforeAction
(
function()
{
if (!Meteor.userId())
this.redirect('/');
else
this.next();
}
);
但是當我嘗試
Router.onBeforeAction
(
function()
{
if (!isadmin(Meteor.userId()) && Router.current().route.getName()=='admin')
this.redirect('/');
else
this.next();
}
);
我收到一條消息
iron_core.js哈希的路由調度從來沒有顯示?您是否忘記了在onBeforeAction中調用this.next() ?
這是不是做的最好的方式,但它的工作原理 –