Files
DataStack/vcon/lib/api.ts
T
Md Najmul d39d9f92f9 docs: update AI Studio design token audits
Refresh design token inventory files to reflect the latest UI sizing and layout configurations from the sandbox prototype.
2026-10-23 11:43:49 -05:00

17 lines
434 B
TypeScript

export async function vconApiFetch<T>(endpoint: string, options?: RequestInit): Promise<T> {
const res = await fetch(endpoint, {
...options,
headers: {
'Content-Type': 'application/json',
...options?.headers,
},
});
if (!res.ok) {
const errorBody = await res.json().catch(() => ({}));
throw new Error(errorBody.error || `API error ${res.status}: ${res.statusText}`);
}
return res.json();
}