1
Im使用alanning-roles包和Meteor.method創建一個包含角色的賬戶,但賬戶被創建爲沒有任何角色。具有角色的賬戶MeteorJS
瀏覽器控制檯拋出Internal 505 error
和服務器控制檯拋出invalid createUser Method.
這是我的方法。
Meteor.methods({
createUser:function(password,email,username){ //Normal Account
var rol = "Normal",
account = Accounts.createUser({
email:email,
password:password,
username:username
});
console.log(account) //returns id wich i need to add the user to the rol
Roles.addUsersToRoles(account, rol);
return account;
}
})
並且像在事件處理程序上那樣調用它。
Meteor.call('createUser',"example123","[email protected]","example",function(error,account){
if(error){
console.log(error.reason)
}else{
console.log("user created")
}
})
謝謝你的答案,讓我試試更新:謝謝ethan它的任何理由爲什麼它應該是一個數組而不是一個字符串? –