유성 v1.0을 출시하기 전에, 나는 성공이 코드를 실행중인 : 유성 v1.0을하기 때문에, this.next()가 필요하다철 라우터 onBeforeAction 유성 V1.0
onBeforeAction: function(){
if(Meteor.userId()){
Meteor.call('create_game', this.params._id, 1, function(error, result){
if (error)
console.log(error);
else{
var game_id = result;
Session.set('gamesolo_id', game_id);
}
});
}
},
waitOn: function() { return Meteor.subscribe('game', Session.get('gamesolo_id'))},
onBeforeAction 후크. 나는 이것을 시도했다 :
onBeforeAction: function(){
if(Meteor.userId()){
Meteor.call('create_game', this.params._id, 1, function(error, result){
if (error)
console.log(error);
else{
var game_id = result;
Session.set('gamesolo_id', game_id);
}
});
this.next();
}
},
waitOn: function() { return Meteor.subscribe('game', Session.get('gamesolo_id'))},
그러나 이것은 반복적 인 방법으로 호출한다. 문제를 해결하는 방법을 알려주세요.
아마도'if' 문 외부에'this.next()'를 넣으십시오. – Sindis
답장을 보내 주셔서 감사합니다. 그러나 바깥 세상은 아무 것도 변하지 않습니다. 메서드는 영원히 루프이며, 템플릿은 로딩 템플릿과 페이지 템플릿 사이를 계속 전환합니다. – user2409399