techprotrade's picture
download
raw
578 Bytes
const BASE_URL = `${import.meta.env.VITE_SUPABASE_URL}/functions/v1`;
const AUTH = `Bearer ${import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY}`;
export async function apiCall<T = any>(fn: string, body: Record<string, any>): Promise<T> {
const resp = await fetch(`${BASE_URL}/${fn}`, {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: AUTH },
body: JSON.stringify(body),
});
if (!resp.ok) {
const err = await resp.json().catch(() => ({}));
throw new Error(err.error || `API error ${resp.status}`);
}
return resp.json();
}

Xet Storage Details

Size:
578 Bytes
·
Xet hash:
939e766a115f725b59e3313c40d2723e320f4dce929b2e42fa78dbc790c37e70

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.