UNPKG

@nhost/nhost-js

Version:

Nhost JavaScript SDK

2 lines 681 B
import{c as t,s as e}from"../fetch-CaGArzje.js";var s=(s,a=[])=>{let n=t(a);const o=async(t,a)=>{const o=await n(`${s}${t}`,a);let i;if(i=o.headers.get("content-type")?.includes("application/json")?await o.json():o.headers.get("content-type")?.startsWith("text/")?await o.text():await o.blob(),!o.ok)throw new e(i,o.status,o.headers);return{status:o.status,body:i,headers:o.headers}};return{baseURL:s,fetch:o,post:async(t,e,s={})=>o(t,{...s,method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...s.headers},body:e?JSON.stringify(e):void 0}),pushChainFunction:e=>{a.push(e),n=t(a)}}};export{s as createAPIClient}; //# sourceMappingURL=functions.js.map