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 1010 history ,
1111 location ,
1212) {
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- }
2113
2214 // Collect the URL parameters
2315 var parameters = { } ;
6860 var headers = opts . headers || { } ;
6961 headers [ 'Accept' ] = headers [ 'Accept' ] || 'application/json' ;
7062 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+ }
7172 if ( csrftoken ) {
7273 headers [ 'X-CSRFToken' ] = csrftoken
7374 }
75+
7476 return fetch ( fetchURL , {
7577 method : "post" ,
7678 headers : headers ,
You can’t perform that action at this time.
0 commit comments