我不明白,我创建了这个方法
import { Accounts } from 'meteor/accounts-base';
import SimpleSchema from 'simpl-schema';
import { ValidatedMethod } from 'meteor/mdg:validated-method';
export const createUser = new ValidatedMethod({
name: 'createUser',
validate: new SimpleSchema({
email: { type: String, optional: true },
}).validator(),
run({email}) {
if (this.isSimulation) return true;
;
const userId = Accounts.createUser({ email, password:'coucou' });
return 'ok'
},
});
当我调用它时:
import { createUser } from '../../../api/auth/methods.js'
createUser.call({ email: this.email.value }, function(err, data) {
if(err){
console.log('err: ', err);
}else{
console.log('data: ', data);
}
我在服务器端有这个错误:
Error: A method named 'createUser' is already defined
所以,如果我改变了方法的名称是有效的。
但是,我想了解
1)为什么已经定义了'createUser'?
2)'createUser'默认方法来自哪里?
谢谢 ;-)