File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
graphene_django/static/graphene_django Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 10
10
history ,
11
11
location ,
12
12
) {
13
- // Parse the cookie value for a CSRF token
14
- var csrftoken ;
15
- var cookies = ( "; " + document . cookie ) . split ( "; csrftoken=" ) ;
16
- if ( cookies . length == 2 ) {
17
- csrftoken = cookies . pop ( ) . split ( ";" ) . shift ( ) ;
18
- } else {
19
- csrftoken = document . querySelector ( "[name=csrfmiddlewaretoken]" ) . value ;
20
- }
21
13
22
14
// Collect the URL parameters
23
15
var parameters = { } ;
68
60
var headers = opts . headers || { } ;
69
61
headers [ 'Accept' ] = headers [ 'Accept' ] || 'application/json' ;
70
62
headers [ 'Content-Type' ] = headers [ 'Content-Type' ] || 'application/json' ;
63
+
64
+ // Parse the cookie value for a CSRF token
65
+ var csrftoken ;
66
+ var cookies = ( "; " + document . cookie ) . split ( "; csrftoken=" ) ;
67
+ if ( cookies . length == 2 ) {
68
+ csrftoken = cookies . pop ( ) . split ( ";" ) . shift ( ) ;
69
+ } else {
70
+ csrftoken = document . querySelector ( "[name=csrfmiddlewaretoken]" ) . value ;
71
+ }
71
72
if ( csrftoken ) {
72
73
headers [ 'X-CSRFToken' ] = csrftoken
73
74
}
75
+
74
76
return fetch ( fetchURL , {
75
77
method : "post" ,
76
78
headers : headers ,
You can’t perform that action at this time.
0 commit comments