diff --git a/static/build/index.js b/static/build/index.js index 122ad60..3e4e9b6 100644 --- a/static/build/index.js +++ b/static/build/index.js @@ -60,6 +60,21 @@ function checkUsernameAvailability() { } }; xhr.send(); + // Disable the button to prevent multiple clicks + submitBtn.disabled = true; + + // Show the spinner + const spinner = document.createElement('i'); + spinner.classList.add('fas', 'fa-spinner', 'fa-spin'); + submitBtn.innerHTML = ''; + submitBtn.appendChild(spinner); + + // Enable the button and remove the spinner after 5 seconds + setTimeout(function () { + submitBtn.disabled = false; + submitBtn.innerHTML = 'Sign Up'; + }, 5000); + sleep(5000).then(() => { submitBtn.disabled = false; }); } function sleep(ms) {