Question

I'm trying to make Meteor always redirect to a User's Dashboard after login. For some reason this isn't working. Any ideas?

Accounts.onLogin(function() {
  return    Router.render('/dashboard');
});
Was it helpful?

Solution

So I was trying to do this in an Accounts document with the onLogin function. It was easily handled in the router.js document as follows:

var goToDashboard = function(pause) {
  if (Meteor.user()) {
    Router.go('dashboard');
    pause();
  }
};

Router.onBeforeAction(goToDashboard, {except: ['signin']});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top