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');
});
Était-ce utile?

La 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']});
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top