File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,14 @@ export default class AutoCheckElement extends HTMLElement {
86
86
this . removeAttribute ( 'required' )
87
87
}
88
88
}
89
+
90
+ get csrfField ( ) : string {
91
+ return this . getAttribute ( 'csrf-field' ) || 'authenticity_token'
92
+ }
93
+
94
+ set csrfField ( value : string ) {
95
+ this . setAttribute ( 'csrf-field' , value )
96
+ }
89
97
}
90
98
91
99
function setLoadingState ( event : Event ) {
@@ -151,6 +159,7 @@ async function check(autoCheckElement: AutoCheckElement) {
151
159
return
152
160
}
153
161
162
+ const csrfField = autoCheckElement . csrfField
154
163
const src = autoCheckElement . src
155
164
const csrf = autoCheckElement . csrf
156
165
const state = states . get ( autoCheckElement )
@@ -171,7 +180,7 @@ async function check(autoCheckElement: AutoCheckElement) {
171
180
}
172
181
173
182
const body = new FormData ( )
174
- body . append ( 'authenticity_token' , csrf )
183
+ body . append ( csrfField , csrf )
175
184
body . append ( 'value' , input . value )
176
185
177
186
input . dispatchEvent (
You can’t perform that action at this time.
0 commit comments