So in my routes (FlowRouter) I have a group for my admin panel
var ACPRoutes = FlowRouter.group({
prefix: '/admin',
name: 'admin',
triggersEnter: [function(context, redirect) {
if(!Meteor.userId()) {
FlowRouter.go('/');
} else {
if(!Roles.userIsInRole(Meteor.userId(), ['admin'])) {
FlowRouter.go('/');
}
}
}],
action: function() {
Session.set('DocumentTitle', 'Admin Control Panel');
}
});
The problem here is that if I reload the page with CTRL+R or navigate to /admin through anything that is not a link on the site, the role check always return false. Why is that? How can it be fixed?