Closed emehmet closed 8 years ago
@emehmet I'm not sure i totally understand your question or what you're trying to accomplish, but Meteor.user()
is reactive, so the workList
helper gets re-run when you log in or out, because the user is changing.
to avoid the error, you need to check whether there is a user first, before trying to get their profile, like this (called adding a 'guard'):
Meteor.user() && Meteor.user().profile
I'm using Meteor.user().profile in helper. When i do logout, i gets error profile undefined. My code below:
I'm doing logout in listedWork page for example: localhost/listedWork. That is iron router render code
When i logout here, Meteor.user().profile is call by workList that's why i get this error.
login template render in onBeforeAction for logout. Why listedWork template helper call this here.
Thank you for all helps.