【发布时间】:2016-08-07 06:23:00
【问题描述】:
带有 mdg:validated-method 的 Meteor 1.3
imports/api/user/methods.js
export const register = new ValidatedMethod({
name: 'register',
validate: new SimpleSchema({
mobile: { type: String },
}).validator(),
run({ mobile }) {
let response = {
success: false,
message: 'Error'
};
if(true) {
response.success = true;
response.message: 'Done';
}
return response;
}
});
imports/ui/pages/home.js
UserMethods.register.call({mobile}, (error, response) => {
console.log(error); // okay
console.log(response); // unable to access response
if(response.success) {
template.$('#enter-mobile').hide();
template.$('#enter-otp').fadeIn();
}
});
我无法在UserMethods.register.call({mobile}, (error, response) 中访问response
如何解决这个问题?
【问题讨论】:
标签: meteor meteor-helper