Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inject @Req / context / info to @ResolveProperty() #16

Closed
hkjeffchan opened this issue Apr 9, 2018 · 4 comments
Closed

inject @Req / context / info to @ResolveProperty() #16

hkjeffchan opened this issue Apr 9, 2018 · 4 comments

Comments

@hkjeffchan
Copy link

hkjeffchan commented Apr 9, 2018

In @query, we get the parameters (args, context, info) like this

@Query()
user(_, args, context, info) {

And req can be retrieved from context or info

Is it possible to get the req from @ResolveProperty too? I have tried something like this but it does not work.

@ResolveProperty()
userExperience(user: user, @Req() request) {
@hkjeffchan
Copy link
Author

@ResolveProperty()
userExperience(user: user, @Req() request, @Req() request2) {

Just found that request is empty object and request2 does get the request object. What is the correct way to get the request object? Thanks.

@hkjeffchan
Copy link
Author

I am stupid...

Just found from the apollo doc that ResolveProperty and Query share the same resolver function signature.

fieldName(obj, args, context, info) { result }

https://www.apollographql.com/docs/graphql-tools/resolvers.html

@4F2E4A2E
Copy link

@hkjeffchan at some level we all are :)
Keep giving back to the community, that's great! 👍

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants