I have a FlowRouter setup that basically says:
“Make sure a user is signed in, and if they are not, re-route them to the login page. Do this for every route, except for this list of routes (then I have an array of hard-coded routes that are exempt from the signed in requirement)”
The code is below
My problem is that I’d like to give users a public profile page. These will be created dynamically, so I can’t continually hard code it into my array of exempt routes.
Ideally, I’d create a route group called “public” (or something) and put the “public” group into that array of exempt routes. But I’m pretty sure that I tried this and the exempt array only takes in specific routes and not the prefixes/groups…
Does anybody know the solution for this?
FlowRouter.triggers.enter([function(context, redirect){
if(!Meteor.userId()) {
FlowRouter.go('login');
}
}], {except: [
"sign-up",
"login",
"LandingPage",
]});
//***** ON LOGIN AND ON LOGOUT
// these methods need to run on the client
if(Meteor.isClient) {
Accounts.onLogin(function(){
FlowRouter.go('HomeDashboardPage');
});
Accounts.onLogout(function(){
FlowRouter.go('login');
});
}