mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-10 19:57:15 +03:00
Pass options from the fragment, not the template context
This commit is contained in:
parent
3755850c2e
commit
0d8f9db3fb
|
@ -100,22 +100,27 @@ add "&raw" to the end of the URL within a browser.
|
||||||
function updateURL() {
|
function updateURL() {
|
||||||
history.replaceState(null, null, locationQuery(parameters));
|
history.replaceState(null, null, locationQuery(parameters));
|
||||||
}
|
}
|
||||||
// Render <GraphiQL /> into the body.
|
// If there are any fragment parameters, confirm the user wants to use them.
|
||||||
ReactDOM.render(
|
if (Object.keys(parameters).length
|
||||||
React.createElement(GraphiQL, {
|
&& !window.confirm("An untrusted query has been loaded, continue loading query?")) {
|
||||||
fetcher: graphQLFetcher,
|
parameters = {};
|
||||||
|
}
|
||||||
|
var options = {
|
||||||
|
fetcher: graphQLFetcher,
|
||||||
onEditQuery: onEditQuery,
|
onEditQuery: onEditQuery,
|
||||||
onEditVariables: onEditVariables,
|
onEditVariables: onEditVariables,
|
||||||
onEditOperationName: onEditOperationName,
|
onEditOperationName: onEditOperationName,
|
||||||
query: '{{ query|escapejs }}',
|
query: parameters.query,
|
||||||
response: '{{ result|escapejs }}',
|
}
|
||||||
{% if variables %}
|
if (parameters.variables) {
|
||||||
variables: '{{ variables|escapejs }}',
|
options.variables = parameters.variables;
|
||||||
{% endif %}
|
}
|
||||||
{% if operation_name %}
|
if (parameters.operation_name) {
|
||||||
operationName: '{{ operation_name|escapejs }}',
|
options.operationName = parameters.operation_name;
|
||||||
{% endif %}
|
}
|
||||||
}),
|
// Render <GraphiQL /> into the body.
|
||||||
|
ReactDOM.render(
|
||||||
|
React.createElement(GraphiQL, options),
|
||||||
document.body
|
document.body
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user