Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
srt32 authored May 24, 2024
1 parent 1ba5238 commit 6cde2e8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/auto-check-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function setLoadingState(event: Event) {
const state = states.get(autoCheckElement)

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

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

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

const body = new FormData()
if (this.httpMethod) {
if (httpMethod === 'POST') {
body.append(csrfField, csrf)
body.append('value', input.value)
} else {
url = new URL(src, window.location.origin);
url.search = new URLSearchParams({ value: input.value }).toString();
url = new URL(src, window.location.origin)
url.search = new URLSearchParams({value: input.value}).toString()
}

input.dispatchEvent(new AutoCheckSendEvent(body))
Expand Down

0 comments on commit 6cde2e8

Please sign in to comment.