@@ -191,10 +191,11 @@ function setLoadingState(event: Event) {
191
191
192
192
const src = autoCheckElement . src
193
193
const csrf = autoCheckElement . csrf
194
+ const httpMethod = autoCheckElement . httpMethod
194
195
const state = states . get ( autoCheckElement )
195
196
196
197
// If some attributes are missing we want to exit early and make sure that the element is valid.
197
- if ( ! src || ( this . httpMethod === 'POST' && ! csrf ) || ! state ) {
198
+ if ( ! src || ( httpMethod === 'POST' && ! csrf ) || ! state ) {
198
199
return
199
200
}
200
201
@@ -242,9 +243,10 @@ async function check(autoCheckElement: AutoCheckElement) {
242
243
const src = autoCheckElement . src
243
244
const csrf = autoCheckElement . csrf
244
245
const state = states . get ( autoCheckElement )
246
+ const httpMethod = autoCheckElement . httpMethod
245
247
246
248
// If some attributes are missing we want to exit early and make sure that the element is valid.
247
- if ( ! src || ( this . httpMethod === 'POST' && ! csrf ) || ! state ) {
249
+ if ( ! src || ( httpMethod === 'POST' && ! csrf ) || ! state ) {
248
250
if ( autoCheckElement . required ) {
249
251
input . setCustomValidity ( '' )
250
252
}
@@ -259,7 +261,7 @@ async function check(autoCheckElement: AutoCheckElement) {
259
261
}
260
262
261
263
const body = new FormData ( )
262
- if ( this . httpMethod === 'POST' ) {
264
+ if ( httpMethod === 'POST' ) {
263
265
body . append ( csrfField , csrf )
264
266
body . append ( 'value' , input . value )
265
267
} else {
@@ -281,7 +283,7 @@ async function check(autoCheckElement: AutoCheckElement) {
281
283
const response = await fetchWithNetworkEvents ( autoCheckElement , src , {
282
284
credentials : 'same-origin' ,
283
285
signal : state . controller . signal ,
284
- method : this . httpMethod ,
286
+ method : httpMethod ,
285
287
body,
286
288
} )
287
289
if ( response . ok ) {
0 commit comments