Meteor-Community-Packages / Meteor-Community-Packages/meteor-method-hooks

No access to meteor methods result

Open
#12 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
26
Forks
7
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown Meteor.afterMethod('createProject', ...) hook and the Meteor.methods createProject example. Trace how the hook callback receives arguments and determine why the method return value is absent; done means the callback receives the result returned by createProject without losing its existing arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.