Open veeramarni opened 5 years ago
I'm currently facing the same problem. I'd like to inject some context into the client's query function and work with that inside the resolver.
const schema = makeExecutableSchema({
typeDefs,
resolvers
});
const client = new ApolloClient({
link: new SchemaLink({ schema }),
cache: new InMemoryCache(),
});
const result = await client.query({ query: qry, context: "hallo" });
And the resolver:
Query: {
item: (root: any, args: any, context: any, info: any) => {
console.log("ctx", context);
return {};
}
}
Executing this logs undefined
.
@wawhal sorry for pinging, but do you have any idea?
Similar to graphql server, can we add something to the context which could be used for resolver.
For example