Meteorjs推迟回调

时间:2017-08-13 11:01:55

标签: javascript meteor meteor-methods

流星版本METEOR@1.5.1

我在流星方法上遇到错误。当我调用方法并且它完成它工作时,控制台会抛出错误。

Exception in defer callback: TypeError: callback is not a function
    at http://localhost:3000/packages/mongo.js?hash=e92cf37034f2703254bf91c2d4a148271b91342c:734:5
    at http://localhost:3000/packages/minimongo.js?hash=4f5c421ee64a333e2a96f515d4287fc153ec9252:700:5
    at Meteor.EnvironmentVariable.EVp.withValue (http://localhost:3000/packages/meteor.js?hash=6d285d84547b3dad9717a7c89c664b61b45ea3d8:1090:15)
    at http://localhost:3000/packages/meteor.js?hash=6d285d84547b3dad9717a7c89c664b61b45ea3d8:471:25
    at Object.<anonymous> (http://localhost:3000/packages/meteor.js?hash=6d285d84547b3dad9717a7c89c664b61b45ea3d8:1117:22)
    at onGlobalMessage (http://localhost:3000/packages/meteor.js?hash=6d285d84547b3dad9717a7c89c664b61b45ea3d8:398:23)

这是方法

new ValidatedMethod({
    name: 'Courses.update',
    validate: function(){},
    run: function(object) {
        const { id ,  title , description , price , cover , category } = object;
        return Courses.update({
            "_id":id,
            creator:Meteor.userId()
        },{
            $set:{
                title : title,
                description : description,
                price : price,
                cover : cover,
                category : category
            }
        });
    }
});

这是方法调用

Meteor.call('Courses.update',obj,function(err,resp){
                if(!err){
                    Materialize.updateTextFields();
                    Materialize.toast('Kurs Güncellenmiştir',2500,'green darken-2');
                }
            })

0 个答案:

没有答案