2017-09-11 1 views
0

Routes.jsをリダイレクトしません:Router.goはTemplate.events

Router.configure({ 
    layoutTemplate: "defaultLayout", 
    before: function() { 
    if(!Meteor.user()) { 
     this.layout("loginLayout"); 
     this.render('login'); 
    }else{ 
     this.layout("defaultLayout"); 
     this.next(); 
    } 
    } 
}); 

Router.route('/',function(){ 
    this.render('login'); 
    this.layout('loginLayout'); 
}); 

Router.route('/botlist',{ 
    template: "projects", 
    name: "projects", 
    data: function(){ 
    return Projects.find({}); 
    },  
    waitOn: function(){ 
    return Meteor.subscribe('projects',Session.get("username")); 
    } 
}); 

私はそのjsのように見えるのログインページがあります。

.... 
    'click #btn-login'(e, t) { 
    var username = $('#email').val(),password = $('#password').val(); 
    Meteor.call('loginWithad',username,password,function(err,response){ 
     if(response.err){ 
     ..    } 
     else{ 
     Meteor.call('finishLogin',username,password,function(err,res){ 
      if(err){ 
      ... 
      } 
      else{ 
      Session.set("username",res.givenName); 
      Router.go("/botlist"); //--> this router.go doesn't route to /botlist template       
      } 
     }) 
     .... 

私のルータの定義上の任意の問題が?私は、複数のソリューションのどれも働いていない試してみました:

  1. this.redirect()
  2. Router.push
  3. this.stop()その後、Router.go()

答えて

0

をあなたは、パラメータとしてルートの名前を与える必要があります。だから、:

Router.go("projects"); 

変更

Router.go("/botlist"); 

関連する問題