añadida validacion de email contra el back

This commit is contained in:
2025-12-03 20:34:15 -03:00
parent 8ac7b7a8cb
commit 43f9c9f5d8
2 changed files with 44 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
import { apiBase } from "@/stores/url";
import { get } from "svelte/store";
export async function checkEmail(email: string) {
try {
const req = await fetch(`${get(apiBase)}/api/users/check-email/${email}`, {
method: "GET"
});
if (req.ok){
return (await req.json()).available;
}
return false;
} catch {
return false;
}
}