Meteor - 发布错误

时间:2016-02-23 04:32:12

标签: meteor

我正在建立一个教师和学生互动的应用程序。我试图发布教师/学生关系的课程。如何发布包含teacherUserIdstudentUserId的类。

路径:publish.js

Meteor.publish('classes', function(group){
    if (Roles.userIsInRole(this.userId, ['is_teacher'], group)) {

    check(id, String);
    return Classes.find({teacherUserId: this.userId, studentUserId: id});

    } else {

    // user not authorized. do not publish secrets
    this.stop();
    return;

    }
});

路径:class.js

Template.classes.onCreated(function() {
    var self = this;
    self.autorun(function(){
        self.subscribe('classes');
    });
});

Template.classes.helpers({
    studentProfileId: () => {
        return FlowRouter.getParam('id');
    }
});

0 个答案:

没有答案