我正在尝试检查onBeforeAction挂钩内的路由器上的电子邮件是否已经过验证,但是它会丢失2个错误。你知道如何解决这两个问题吗?
错误1:
Exception in callback of async function: .onBeforeAction@http://localhost:3000/lib/router.js?5f85a874ea86a78deb8c19a394c27e00c5a5f753:34:9
错误2:
Route dispatch never rendered. Did you forget to call this.next() in an onBeforeAction?
代码:
onBeforeAction: function () {
if (Meteor.user()) {
var user = Meteor.user();
if (!user.emails[0].verified) { // line 34
Router.go('confirmEmail');
} else if (!user.gamertagScanned) {
Router.go('confirmGt');
} else {
this.next();
}
} else {
this.render('aboutUs');
}
},
答案 0 :(得分:1)
你不应该在 onBeforeAction 中做Router.go()
- 我怀疑你想要this.render('confirmEmail')
和this.render('confirmGt')
。