mirror of
https://github.com/AMNatty/Mastodon-Circles.git
synced 2024-11-25 04:27:27 -07:00
Cleaned up the promise mapping in apiRequestWithHeaders
This commit is contained in:
parent
edd46a4a1b
commit
ff0f81d475
1 changed files with 1 additions and 5 deletions
|
@ -18,11 +18,7 @@ async function apiRequestWithHeaders(url, options = null) {
|
||||||
|
|
||||||
throw new Error(`Error fetching ${url}: ${response.status} ${response.statusText}`);
|
throw new Error(`Error fetching ${url}: ${response.status} ${response.statusText}`);
|
||||||
})
|
})
|
||||||
.then(response => new Promise((resolve, reject) => {
|
.then(async response => ({ headers: response.headers, body: await response.json() }))
|
||||||
response.json()
|
|
||||||
.then(rbody => resolve({headers: response.headers, body: rbody}))
|
|
||||||
.catch(error => reject(error))
|
|
||||||
}))
|
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error(`Error fetching ${url}: ${error}`);
|
console.error(`Error fetching ${url}: ${error}`);
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue