-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.min.js
1 lines (1 loc) · 1.54 KB
/
index.min.js
1
"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]])}return n};function _fetch(t,e,n,r){void 0===e&&(e={});var s=e.responseAs,o=void 0===s?"json":s,i=__rest(e,["responseAs"]);return i.headers=__assign({Accept:"application/json","Content-Type":"application/json"},i.headers),r&&(t+="?"+new URLSearchParams(r)),void 0!==n?i.body=JSON.stringify(n):delete i.body,fetch(t,i).then(function(t){if(t.status<200||300<=t.status)throw new Error(t.statusText);return"response"===o?t:204===t.status?null:t[o]()})}function esfetch(n,r){void 0===r&&(r={});function t(t,e){return void 0===e&&(e={}),esfetch(n+"/"+t,__assign({},r,e))}return t.get=function(t){return _fetch(n,__assign({},r,{method:"GET"}),void 0,t)},t.post=function(t){return _fetch(n,__assign({},r,{method:"POST"}),t)},t.put=function(t){return _fetch(n,__assign({},r,{method:"PUT"}),t)},t.patch=function(t){return _fetch(n,__assign({},r,{method:"PATCH"}),t)},t.delete=function(){return _fetch(n,__assign({},r,{method:"DELETE"}))},t}exports.__esModule=!0,exports.default=esfetch;