UNPKG

@ritttzy/core

Version:

## Project setup ``` npm install ```

2 lines 1.37 kB
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["ritttzy-core"]=t():e["ritttzy-core"]=t()})("undefined"!==typeof self?self:this,(function(){return function(){"use strict";var e={};!function(){e.d=function(t,o){for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})}}(),function(){e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){e.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){e.p=""}();var t={};if(e.r(t),e.d(t,{doFetch:function(){return r}}),"undefined"!==typeof window){var o=window.document.currentScript,n=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);n&&(e.p=n[1])}async function r(e,t="GET",o=null,n={}){const r={};n.contentType??="application/json",o&&"application/json"==n.contentType&&(o=JSON.stringify(o)),n.return??="json";try{let c=await fetch(e,{headers:r,method:t,body:o});return c.ok?("json"==n.return&&(c=await c.json()),{ok:!0,completed:!0,body:c}):{ok:!1,completed:!0,body:{message:c.message}}}catch(c){return{ok:!1,completed:!1,body:{message:c.message}}}}return t}()})); //# sourceMappingURL=ritttzy-core.umd.min.js.map