mirror of
				https://github.com/graphql-python/graphene-django.git
				synced 2025-10-31 16:07:36 +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?")) { | ||||||
|  |       parameters = {}; | ||||||
|  |     } | ||||||
|  |     var options = { | ||||||
|       fetcher: graphQLFetcher, |       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