Liferay.Loader.define("commerce-organization-web@5.0.37/js/utils/fetch",["module","exports","require","frontend-js-web"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.fetchFromHeadless=function(t,r={},o,s){return(0,n.fetch)(t,c({headers:e},r)).then(i).then((e=>a(e,o))).catch((e=>u(e,s)))},t.handleFetchResponse=i,t.handleResponseOk=a,t.handleResponseNotOk=u;var n=r("frontend-js-web");function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const e=new Headers({Accept:"application/json","Accept-Language":Liferay.ThemeDisplay.getBCP47LanguageId(),"Content-Type":"application/json"});function i(e){return e.json().then((t=>e.ok?Promise.resolve(t):Promise.reject(t))).catch((t=>e.ok?Promise.resolve(null):Promise.reject(c(c({},t),{},{title:t.title||t.status}))))}function a(e,t){return t&&(0,n.openToast)({message:t,type:"success"}),e}function u(e,t=!1){throw console.error(e),t&&(0,n.openToast)({message:e.title,type:"danger"}),e}}}));
//# sourceMappingURL=fetch.js.map