Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
feat: trim & lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev authored May 10, 2023
1 parent f8adaab commit 8d145eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ <h1 class="text-3xl font-bold mb-6">Subdomain Checker</h1>
btn.setAttribute("disabled", true);
btn.innerHTML = "Checking Domain...";

fetch(`https://api.freesubdomains.org/check?domain=${subdomain.value}.${domain.value}`).then(res => res.json()).then(data => {
fetch(`https://api.freesubdomains.org/check?domain=${subdomain.value.trim().toLowerCase()}.${domain.value}`).then(res => res.json()).then(data => {
btn.removeAttribute("disabled");
btn.innerHTML = "Check Domain";

if(data.message === "DOMAIN_AVAILABLE") {
status.classList = "text-green-600 font-semibold";
status.innerHTML = `Congratulations, ${subdomain.value}.${domain.value} is available! <a href="https://github.com/free-domains/register#register" class="underline underline-2 hover:no-underline">Register now!</span>`;
status.innerHTML = `Congratulations, ${subdomain.value.trim().toLowerCase()}.${domain.value} is available! <a href="https://github.com/free-domains/register#register" class="underline underline-2 hover:no-underline">Register now!</span>`;
} else {
status.classList = "text-red-600 font-semibold";
status.innerHTML = `Sorry, ${subdomain.value}.${domain.value} is unavailable!`;
status.innerHTML = `Sorry, ${subdomain.value.trim().toLowerCase()}.${domain.value} is unavailable!`;
}

form.reset();
})
}
</script>
</html>
</html>

0 comments on commit 8d145eb

Please sign in to comment.