mirror of
				https://github.com/graphql-python/graphene-django.git
				synced 2025-10-31 16:07:36 +03:00 
			
		
		
		
	Read csrftoken from DOM if no cookie is set (#826)
This commit is contained in:
		
							parent
							
								
									3d01acf169
								
							
						
					
					
						commit
						45df7445f4
					
				|  | @ -3,8 +3,11 @@ | |||
|   // Parse the cookie value for a CSRF token
 | ||||
|   var csrftoken; | ||||
|   var cookies = ('; ' + document.cookie).split('; csrftoken='); | ||||
|   if (cookies.length == 2) | ||||
|   if (cookies.length == 2) { | ||||
|     csrftoken = cookies.pop().split(';').shift(); | ||||
|   } else { | ||||
|     csrftoken = document.querySelector("[name=csrfmiddlewaretoken]").value; | ||||
|   } | ||||
| 
 | ||||
|   // Collect the URL parameters
 | ||||
|   var parameters = {}; | ||||
|  |  | |||
|  | @ -31,6 +31,7 @@ add "&raw" to the end of the URL within a browser. | |||
|           crossorigin="anonymous"></script> | ||||
| </head> | ||||
| <body> | ||||
|   {% csrf_token %} | ||||
|   <script src="{% static 'graphene_django/graphiql.js' %}"></script> | ||||
| </body> | ||||
| </html> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user