añadida validacion de email contra el back

This commit is contained in:
fede committed 2025-12-03 20:34:15 -03:00
1 parent 8ac7b7a8cb
commit 43f9c9f5d8
2 files changed
+44 -2

No files matched your search

+16
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;
}
}