onBeforeAction:如何检查已验证的电子邮件
onBeforeAction: How to Check Email Verified
我正在尝试检查电子邮件是否在路由器上的 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');
}
},
您不应该在 onBeforeAction 中执行 Router.go()
- 我怀疑您想要 this.render('confirmEmail')
和 this.render('confirmGt')
。
我正在尝试检查电子邮件是否在路由器上的 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');
}
},
您不应该在 onBeforeAction 中执行 Router.go()
- 我怀疑您想要 this.render('confirmEmail')
和 this.render('confirmGt')
。