Reputation: 8172
I want restrict non logged in users from viewing some pages in my app by redirecting them to the login page. I use react, flow router and the react komposer. The problem is, Meteor.user()
first gives undefined and even-though the user is logged in, he gets re-directed into the login page. How can I fix this?
Upvotes: 0
Views: 521
Reputation: 1039
The method you need is Meteor.loggingIn()
Before redirecting user you need to check if user is logging in like:
if(!Meteor.loggingIn() && !Meteor.userId()){
//do redirect to login page
}
Upvotes: 2