mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 07:33:17 +00:00
Send context in rootValue variable
This commit is contained in:
parent
112a956bab
commit
8c2f7cf8a6
@ -115,10 +115,13 @@ module.exports = function (strapi) {
|
||||
// Define GraphQL route to GraphQL schema
|
||||
// or disable the global variable
|
||||
if (this.defaults.graphql.enabled === true) {
|
||||
strapi.app.use(strapi.middlewares.mount(this.defaults.graphql.route, strapi.middlewares.graphql({
|
||||
strapi.app.use(strapi.middlewares.mount(this.defaults.graphql.route, strapi.middlewares.graphql((request, context) => ({
|
||||
schema: strapi.schemas,
|
||||
pretty: true
|
||||
})));
|
||||
pretty: true,
|
||||
rootValue: {
|
||||
context: context
|
||||
}
|
||||
}))));
|
||||
} else {
|
||||
global.graphql = undefined;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user