Skip to content

Commit 9dc10b4

Browse files
authored
fix this
1 parent a8f6b09 commit 9dc10b4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/auto-check-element.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function setLoadingState(event: Event) {
194194
const state = states.get(autoCheckElement)
195195

196196
// If some attributes are missing we want to exit early and make sure that the element is valid.
197-
if (!src || (httpMethod === 'POST' && !csrf) || !state) {
197+
if (!src || (this.httpMethod === 'POST' && !csrf) || !state) {
198198
return
199199
}
200200

@@ -244,7 +244,7 @@ async function check(autoCheckElement: AutoCheckElement) {
244244
const state = states.get(autoCheckElement)
245245

246246
// If some attributes are missing we want to exit early and make sure that the element is valid.
247-
if (!src || (httpMethod === 'POST' && !csrf) || !state) {
247+
if (!src || (this.httpMethod === 'POST' && !csrf) || !state) {
248248
if (autoCheckElement.required) {
249249
input.setCustomValidity('')
250250
}
@@ -259,12 +259,12 @@ async function check(autoCheckElement: AutoCheckElement) {
259259
}
260260

261261
const body = new FormData()
262-
if (httpMethod === 'POST') {
262+
if (this.httpMethod === 'POST') {
263263
body.append(csrfField, csrf)
264264
body.append('value', input.value)
265265
} else {
266-
url = new URL(src, window.location.origin)
267-
url.search = new URLSearchParams({value: input.value}).toString()
266+
this.url = new URL(src, window.location.origin)
267+
this.url.search = new URLSearchParams({value: input.value}).toString()
268268
}
269269

270270
input.dispatchEvent(new AutoCheckSendEvent(body))
@@ -281,7 +281,7 @@ async function check(autoCheckElement: AutoCheckElement) {
281281
const response = await fetchWithNetworkEvents(autoCheckElement, src, {
282282
credentials: 'same-origin',
283283
signal: state.controller.signal,
284-
method: httpMethod,
284+
method: this.httpMethod,
285285
body,
286286
})
287287
if (response.ok) {

0 commit comments

Comments
 (0)