const d={props:{proxy:Object},created:function(){this.endpoint=this.item.endpoint||this.item.url,this.endpoint.endsWith("/")&&(this.endpoint=this.endpoint.slice(0,-1))},methods:{fetch:function(t,r,o=!0){var s;let e={};(s=this.proxy)!=null&&s.useCredentials&&(e.credentials="include"),this.item.useCredentials!==void 0&&(e.credentials=this.item.useCredentials===!0?"include":"omit"),e=Object.assign(e,r),t.startsWith("/")&&(t=t.slice(1));let n=this.endpoint;return t&&(n=`${this.endpoint}/${t}`),fetch(n,e).then(i=>{if(!i.ok)throw new Error("Not 2xx response");return o?i.json():i})}}};export{d as s};