When developing, everytime I save a file Meteor restarts (which is an excelent feature), however some pages have some validatons based on the user profile and they are redirected to landing page. I was checking and it seems that Meteor.users is not ready yet. How can I sort it?
SpecialController = MainController.extend({
onBeforeAction: function(){
const user = Meteor.users.findOne({_id: Meteor.userId()});
if (user && user.profile.internalStatus == "valid") {
this.next();
} else {
// the routers is sending here but it shouldn't.
Router.go('dashboard');
}
}
});