{"version":3,"file":"fetch_wrapper-BtIREoFd.js","sources":["../../../app/javascript/apps/customer_page/services/fetch_wrapper.js"],"sourcesContent":["export default { jsonClient, httpClient }\n\n\nfunction jsonClient(url, { body, ...params } = {}) {\n const headers = { 'Content-Type': 'application/json' }\n const reqParams = {\n ...params,\n headers: {\n ...headers,\n ...params.headers,\n },\n }\n\n if (body) reqParams.body = JSON.stringify(body)\n\n return window\n .fetch(url, reqParams)\n .then(async response => {\n if (response.ok) {\n return await response.json()\n } else {\n const errorMessage = await response.text()\n return Promise.reject(new Error(errorMessage))\n }\n })\n}\n\nfunction httpClient(url, params = {}) {\n return window\n .fetch(url, params)\n .then(async response => {\n if (response.ok) {\n return await response.text()\n } else {\n const errorMessage = await response.text()\n return Promise.reject(new Error(errorMessage))\n }\n })\n}\n"],"names":["fetchWrapper","jsonClient","httpClient","url","body","params","reqParams","response","errorMessage"],"mappings":"AAAA,MAAeA,EAAA,CAAE,WAAAC,EAAY,WAAAC,CAAU,EAGvC,SAASD,EAAWE,EAAK,CAAE,KAAAC,EAAM,GAAGC,CAAM,EAAK,CAAA,EAAI,CAEjD,MAAMC,EAAY,CAChB,GAAGD,EACH,QAAS,CACP,GAJY,CAAE,eAAgB,kBAAkB,EAKhD,GAAGA,EAAO,OACX,CACL,EAEE,OAAID,IAAME,EAAU,KAAO,KAAK,UAAUF,CAAI,GAEvC,OACJ,MAAMD,EAAKG,CAAS,EACpB,KAAK,MAAMC,GAAY,CACtB,GAAIA,EAAS,GACX,OAAO,MAAMA,EAAS,KAAI,EACrB,CACL,MAAMC,EAAe,MAAMD,EAAS,KAAI,EACxC,OAAO,QAAQ,OAAO,IAAI,MAAMC,CAAY,CAAC,CACrD,CACK,CAAA,CACL,CAEA,SAASN,EAAWC,EAAKE,EAAS,GAAI,CACpC,OAAO,OACJ,MAAMF,EAAKE,CAAM,EACjB,KAAK,MAAME,GAAY,CACtB,GAAIA,EAAS,GACX,OAAO,MAAMA,EAAS,KAAI,EACrB,CACL,MAAMC,EAAe,MAAMD,EAAS,KAAI,EACxC,OAAO,QAAQ,OAAO,IAAI,MAAMC,CAAY,CAAC,CACrD,CACK,CAAA,CACL"}