I am still learning flowrouter and am working on a project that uses it. I want to change the behavior of the root route “/” if a user has logged in.
I see lots of examples where within a template context one shows or hides content - but I am wondering if there’s a good pattern for (re)setting the route itself?
Eg, in: router.jsx
if (Meteor.userId()) {
FlowRouter.route('/', {name: 'home', action: render(C.DashProperties, C.MainLayout)});
} else { // non-auth shows default landing
FlowRouter.route('/', {name: 'home', action: render(C.Home, C.NoHeaderLayout)});
}
It feels like there must be some way like this. Does anyone here have experience altering the route itself based on auth and or role? Or is it indeed best to just conditionally render diff stuff in the template (yuck)?