문제

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');
});
도움이 되었습니까?

해결책

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']});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top