Fixed xhr
This commit is contained in:
parent
b9cf282d32
commit
ffaf8558b2
@ -1,9 +1,10 @@
|
||||
{
|
||||
"name": "@ztimson/js-utilities",
|
||||
"version": "0.0.0",
|
||||
"version": "0.1.0",
|
||||
"description": "JavaScript Utility library",
|
||||
"author": "Zak Timson",
|
||||
"license": "MIT",
|
||||
"private": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.zakscode.com/ztimson/js-utilities"
|
||||
|
@ -45,7 +45,7 @@ export class XHR<T> {
|
||||
return fetch(`${this.baseUrl}${href || ''}`.replace(/([^:]\/)\/+/g, '$1'), {
|
||||
headers,
|
||||
method: opts.method || (body ? 'POST' : 'GET'),
|
||||
body: (headers['Content-Type'].startsWith('application/json') && body) ? JSON.stringify(body) : body
|
||||
body: (headers['Content-Type']?.startsWith('application/json') && body) ? JSON.stringify(body) : body
|
||||
}).then(async resp => {
|
||||
for(let fn of this.getInterceptors()) {
|
||||
const wait = new Promise(res =>
|
||||
|
Loading…
Reference in New Issue
Block a user