[SOLVED] [React] Pages/URL Restriction

Many of you have used Rails and Laravel 4+ before and I’m looking for a simlar feature where in Rails has before_action and before_filter.

My app has users with profile and a custom registration form. I also use FlowRouter. I struggle to find out how to prevent a logged in user from accessing the signup page and logged out users on accessing a profile url. I know Meteor has no controller as you’d put a line of code in the respected controller. What addon I’m looking for? I dont see how roles would fit something like this. I’m using React for my views.

With Rails, Devise has all that you need. As for FlowRouter…not sure.

if you have a high level container you can do the user status check in there using the react component life cycle, if you want to do it in the flowrouter, use the triggersEnter hook

Thanks. I can’t use triggersEnter because I need Meteor.user() first and that is defined in the action(). So I placed the code into componentWillMount() but having an issue with routing.

I’ve got it now to work with triggers.