File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -150,14 +150,13 @@ class ListSortable extends SortableBase {
150150 }
151151
152152 public get headers ( ) : Headers {
153- const value = `; ${ document . cookie } ` ;
154- const parts = value . split ( '; csrftoken=' ) ;
155- const csrfToken = parts . length === 2 ? parts [ 1 ] . split ( ';' ) . shift ( ) : null ;
156153 const headers = new Headers ( ) ;
157154 headers . append ( 'Accept' , 'application/json' ) ;
158155 headers . append ( 'Content-Type' , 'application/json' ) ;
159- if ( csrfToken ) {
160- headers . append ( 'X-CSRFToken' , csrfToken ) ;
156+
157+ const inputElement = this . tableBody . closest ( 'form' ) ?. querySelector ( 'input[name="csrfmiddlewaretoken"]' ) as HTMLInputElement ;
158+ if ( inputElement ) {
159+ headers . append ( 'X-CSRFToken' , inputElement . value ) ;
161160 }
162161 return headers ;
163162 }
You can’t perform that action at this time.
0 commit comments