How to make onBeforeAction call wait until a function call inside finishes in meteor.js?
问题 I have a synchronized onBeforeAction method with meteor.js Router.onBeforeAction(function() { var self; self = this; authToken = Session.get('authToken'); if (!authToken) { this.redirect('login'); this.next(); } else { Meteor.call('validateAuthToken', authToken, function (error, result)) { if (result) { self.next(); } else { self.redirect('login'); self.next(); } } } }); I need to validate an authentication token stored in Session by invoking a server call. But this method always throws an