You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to get the info about current user in server side static template. So, I use Meteor.userId() in server side template helper to get current user it works but it throws exception and ask to use this.userId which is undefined in this case.
The text was updated successfully, but these errors were encountered:
Are you sure there is a logged in user when you call the method that is rendering the template? Console log Meteor.userId() from the browser before trigger the method. this.userId returns the userId of the user that called the method, and if it is returning undefined, then most like the current user isn't set.
I'm running into this same issue. This is my method and it returns an error, did you ever fix this issue?
export const keys = new ValidatedMethod({
name: 'get.keys',
validate: new SimpleSchema({
}).validator(),
run({ }) {
if (Roles.userIsInRole(Meteor.userId(), ['admin'])){
return 'test';
} else {
throw new Meteor.Error(500, 'You are not an admin!');
}
},
});
I need to get the info about current user in server side static template. So, I use Meteor.userId() in server side template helper to get current user it works but it throws exception and ask to use this.userId which is undefined in this case.
The text was updated successfully, but these errors were encountered: