mirror of
https://github.com/AMNatty/Mastodon-Circles.git
synced 2024-11-09 12:51:26 -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}`);
|
||||
})
|
||||
.then(response => new Promise((resolve, reject) => {
|
||||
response.json()
|
||||
.then(rbody => resolve({headers: response.headers, body: rbody}))
|
||||
.catch(error => reject(error))
|
||||
}))
|
||||
.then(async response => ({ headers: response.headers, body: await response.json() }))
|
||||
.catch(error => {
|
||||
console.error(`Error fetching ${url}: ${error}`);
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue