javascript - Meteor - Checking login status before rending templates -
javascript - Meteor - Checking login status before rending templates -
new meteor , attempting check if user logged in before rendering templates. able create functionality code below, requires browser page refresh , not automatically updating on page.
if (meteor.isclient) { mustbesignedin(); } function mustbesignedin() { if (meteor.userid() == null) { console.log('not logged in'); } else { loadtemplate_tableview() } } any help appreciated on best way approach without need page reload.
you can straight in template.
class="lang-html prettyprint-override"><template name="templatename"> {{#if currentuser}} <p>you're logged in!</p> {{else}} <p>you're not logged in.</p> {{/if}} </template> for more info currentuser helper, see http://docs.meteor.com/#template_currentuser
javascript meteor
Comments
Post a Comment