File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 86
86
------------
87
87
88
88
* [Custom HTTP headers](Resources/doc/custom-http-headers.md)
89
+ * [Custom GraphiQL parameters](Resources/doc/custom-parameters.md)
89
90
* [Define JavaScript libraries' versions](Resources/doc/libraries-versions.md)
90
91
* [Define a custom GraphQL endpoint](Resources/doc/graphql-endpoint.md)
91
92
Original file line number Diff line number Diff line change
1
+ Custom GraphiQL parameters
2
+ ==========================
3
+
4
+ By default, only the ` fetcher ` parameter is passed to GraphiQL's React component.
5
+ To add more:
6
+
7
+ 1 . Override the default GraphiQL template:
8
+
9
+ ``` yaml
10
+ # config/packages/graphiql.yaml or app/config/config.yml for Symfony without Flex
11
+ overblog_graphiql :
12
+ template : " GraphiQL/index.html.twig"
13
+ ` ` `
14
+
15
+ 2. Create a new template:
16
+
17
+ ` ` ` twig
18
+ {# templates/GraphiQL/index.html.twig # }
19
+ {% extends '@OverblogGraphiQL/GraphiQL/index.html.twig' %}
20
+
21
+ {% block graphiql_params %}
22
+ {{ parent() }},
23
+ defaultQuery : ` query SomeQuery($param: String) {
24
+ items(param: $param) {
25
+ someField
26
+ }
27
+ }`
28
+ {% endblock graphiql_params %}
29
+ ```
Original file line number Diff line number Diff line change 58
58
59
59
ReactDOM .render (
60
60
React .createElement (GraphiQL, {
61
+ {% block graphiql_params % }
61
62
fetcher: graphQLFetcher
63
+ {% endblock graphiql_params % }
62
64
}),
63
65
document .body
64
66
)
You can’t perform that action at this time.
0 commit comments