export type SetupState = { needs_setup: boolean; current_user: { username: string } | null }; export type LinkItem = { id: number; name: string; url: string; description: string; category: string; sort_order?: number; enabled: boolean; icon_url: string | null; }; async function request(path: string, init?: RequestInit): Promise { const res = await fetch(path, { credentials: 'include', headers: init?.body instanceof FormData ? undefined : { 'Content-Type': 'application/json', ...(init?.headers || {}) }, ...init, }); if (!res.ok) throw new Error(await res.text()); return res.status === 204 ? (undefined as T) : ((await res.json()) as T); } export const api = { request };