You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
export async function api<T>(path:string, method='GET', body?:unknown):Promise<T>{const response=await fetch(path,{method,headers:{'Content-Type':'application/json'},body:body?JSON.stringify(body):undefined}),contentType=response.headers.get('content-type')??'';if(!response.ok)throw new Error(await response.text());if(!contentType.includes('application/json'))throw new Error(`API returned ${contentType||'a non-JSON response'} for ${path}. Restart the OpenOrbit server and try again.`);return response.json()}