mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-01 13:10:44 -03:00
17 lines
375 B
TypeScript
17 lines
375 B
TypeScript
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;
|
|
}
|
|
}
|