diff options
Diffstat (limited to 'app/templates/signup.html')
-rw-r--r-- | app/templates/signup.html | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/templates/signup.html b/app/templates/signup.html index 446aaeb..32962b7 100644 --- a/app/templates/signup.html +++ b/app/templates/signup.html @@ -91,21 +91,22 @@ // Prevent default form submission event.preventDefault(); + // Get form data const formData = new FormData(this); - // Send POST request to /signup containing form data + + // Send POST request const response = await fetch('/api/users/register', { method: 'POST', body: formData }); if (response.status != 200) { - const data = await response.json(); - + const data = await response.json() + document.getElementById('error').style.display = 'block'; document.getElementById('error').innerText = data.detail; - } - else { - window.location.href = '/login'; + } else { + window.location.href = '/dashboard'; } }); </script>
\ No newline at end of file |