checkeo si el username esta tomado
This commit is contained in:
1 parent
4f4f2fc9dd
commit
89cc2cbaf6
3 files changed
+53
-5
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { apiBase } from "@/stores/url";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
export async function checkUsername(username: string) {
|
||||
try {
|
||||
const req = await fetch(`${get(apiBase)}/api/users/check-username/${username}`, {
|
||||
method: "GET"
|
||||
});
|
||||
if (req.ok){
|
||||
return (await req.json()).available;
|
||||
}
|
||||
return false;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user