feat: add loading on register button

This commit is contained in:
Restray
2022-04-01 21:41:22 +02:00
parent 986c5b7133
commit 809f40dec9

View File

@@ -19,6 +19,9 @@
emailEl.focus(); emailEl.focus();
}); });
async function handleSubmit() { async function handleSubmit() {
// Prevent double submission
if (loading) return;
if (password !== passwordCheck) { if (password !== passwordCheck) {
return errorNotification('Passwords do not match.'); return errorNotification('Passwords do not match.');
} }
@@ -88,8 +91,13 @@
/> />
<div class="flex space-x-2 h-8 items-center justify-center pt-8"> <div class="flex space-x-2 h-8 items-center justify-center pt-8">
<button type="submit" class="hover:bg-coollabs-100 text-white bg-coollabs" <button
>Register</button type="submit"
class="hover:bg-coollabs-100 text-white"
disabled={loading}
class:bg-transparent={loading}
class:text-stone-600={loading}
class:bg-coollabs={!loading}>{loading ? 'Registering...' : 'Register'}</button
> >
</div> </div>
</form> </form>