adding email validator (#178)

This commit is contained in:
Romulo Gatto
2024-08-25 19:46:55 -03:00
committed by GitHub
parent b56b5d2400
commit 1688773bba

View File

@@ -77,6 +77,15 @@
async function registerUser() {
loading.value = true;
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(email.value)) {
toast.error("Invalid email address");
loading.value = false;
return;
}
const { error } = await api.register({
name: username.value,
email: email.value,