meteor-method-hooks icon indicating copy to clipboard operation
meteor-method-hooks copied to clipboard

No access to meteor methods result

Open FoudreNoire26i opened this issue 3 years ago • 0 comments

Hi, I'm am trying to use your package, it is working, but i have a little problem, when I define before or after hooks, I doesn't have access to Meteor methods result, indeed I can only get function arguments, but on this forum https://forums.meteor.com/t/new-method-hooks/8304 I saw that i can have the arguments and the function result. My hook looks like this : Meteor.afterMethod('createProject', (argObject, result) => { console.log("-----"); console.log(argObject); console.log(result); console.log("-----"); })

and my meteor methods : Meteor.methods({ 'createProject' : function(projectInfo) { return Projects.insert({ title : projectInfo.title ?? '', description : projectInfo.description ?? '', type : projectInfo.type ?? '', domain : projectInfo.domain ?? '', userFirstName : projectInfo.userFirstName ?? "", userLastName : projectInfo.userLastName ?? "", userMail : projectInfo.userMail ?? "", userTel : projectInfo.userTel ?? "", userSituation : projectInfo.userSituation ?? "", termAndCondition : projectInfo.termAndCondition ?? false, nextActionDate : new Date().toLocaleString('fr-FR'), status : 'Nouveau', }) /*} else { console.log("can't create Project with no account") return -1 }*/ })

Thanks

FoudreNoire26i avatar Aug 12 '21 13:08 FoudreNoire26i