【发布时间】:2016-07-21 22:32:53
【问题描述】:
我正在使用流星角色包,在 Flowrouter 上重定向时遇到问题。我在导航栏中有一个将用户重定向到主页的按钮,该按钮因角色而异。问题是角色包需要一些时间才能准备好并抛出错误。 关于如何解决这个问题的任何想法?提前致谢。
FlowRouter.route( '/', {
name: 'home',
triggersEnter: [() => {
if (Meteor.userId()) {
if (Roles.userIsInRole(Meteor.userId(), 'student')) {
FlowRouter.go('internships_next');
} else if (Roles.userIsInRole(Meteor.userId(), 'organization')) {
FlowRouter.go('user_internships');
} else {
throw new Meteor.Error( 500,
'There was an error processing your request. User id: ' + Meteor.userId()
);
}
}
}],
action() {
mount(LayoutContainer, {
content: <LoginContainer/>,
});
},
});
【问题讨论】:
标签: meteor roles flow-router