对 Meteor this.next() 错误 onBeforeAction 感到困惑
Confused About Meteor this.next() Error onBeforeAction
我有以下路由器映射代码:
this.route('confirmTag', {
path: '/confirm-tag',
template: 'confirmTag',
controller: 'SignUpController',
onBeforeAction: function () {
if (Meteor.user()) {
if (typeof user.profile.tag === 'undefined') {
Router.go('confirm');
} else {
Router.go('checkEmail');
}
this.next();
} else {
Router.go('signUp');
}
this.next();
}
});
然而,我一直在控制台中收到此错误:
Exception in callback of async function:
.onBeforeAction@http://localhost:3000/lib/router.js?783dc96a24a92cfd09fbf0ca371d762661a830bb:87:9
示例代码中的第 87 行是:
if (typeof user.profile.tag === 'undefined') {
上面代码中"this.next();"应该放什么或怎么放?
提前致谢。
我没有在任何地方看到 user
定义。怎么样...
this.route('confirmTag', {
path: '/confirm-tag',
template: 'confirmTag',
controller: 'SignUpController',
onBeforeAction: function () {
if (Meteor.user()) {
var user = Meteor.user();
if (typeof user.profile.tag === 'undefined') {
Router.go('confirm');
} else {
Router.go('checkEmail');
}
this.next();
} else {
Router.go('signUp');
}
this.next();
}
});
我有以下路由器映射代码:
this.route('confirmTag', {
path: '/confirm-tag',
template: 'confirmTag',
controller: 'SignUpController',
onBeforeAction: function () {
if (Meteor.user()) {
if (typeof user.profile.tag === 'undefined') {
Router.go('confirm');
} else {
Router.go('checkEmail');
}
this.next();
} else {
Router.go('signUp');
}
this.next();
}
});
然而,我一直在控制台中收到此错误:
Exception in callback of async function:
.onBeforeAction@http://localhost:3000/lib/router.js?783dc96a24a92cfd09fbf0ca371d762661a830bb:87:9
示例代码中的第 87 行是:
if (typeof user.profile.tag === 'undefined') {
上面代码中"this.next();"应该放什么或怎么放?
提前致谢。
我没有在任何地方看到 user
定义。怎么样...
this.route('confirmTag', {
path: '/confirm-tag',
template: 'confirmTag',
controller: 'SignUpController',
onBeforeAction: function () {
if (Meteor.user()) {
var user = Meteor.user();
if (typeof user.profile.tag === 'undefined') {
Router.go('confirm');
} else {
Router.go('checkEmail');
}
this.next();
} else {
Router.go('signUp');
}
this.next();
}
});