流星this.next()错误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();
    }
});

最新更新