So, I wanna check if the user is logged in to render different layout. I’m using react. Thanks for any help
The documentation and the Todos React tutorial could help you :
1 Like
I was thinking that I could to it in Flow Router somehow but I figured out that I’ll do it in a layout component, is it right?
You can do something like
{{#if currentUser}}
// Code if user is logged
{{/if}}
That goes to template , or You can do in JS file something like this ( i think ) – Write helper and do this
checkUser: function() {
if(Meteor.userId()) {
return true;
} else {
return false;
}
}
And than in your template write:
{{#if checkUser}}
// If logged in
{{else}}
// It will display other data when user is not logged in ...
{{/if}}
I think this one is help and probably there is few mistakes but you will learn a better way