forked from AkkomaGang/akkoma-fe
Undo the promise rejection on the json parser error in promisedRequest
to keep the existing behavior in case some parts of the code rely on it and to limit the overall scope of the changes.
This commit is contained in:
parent
18a1f5d62a
commit
ed7310c04b
1 changed files with 7 additions and 12 deletions
|
@ -122,18 +122,13 @@ const promisedRequest = ({ method, url, params, payload, credentials, headers =
|
|||
}
|
||||
return fetch(url, options)
|
||||
.then((response) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
response.json()
|
||||
.then((json) => {
|
||||
if (!response.ok) {
|
||||
return reject(new StatusCodeError(response.status, json, { url, options }, response))
|
||||
}
|
||||
return resolve(json)
|
||||
})
|
||||
.catch((error) => {
|
||||
return reject(new StatusCodeError(response.status, error.message, { url, options }, response))
|
||||
})
|
||||
})
|
||||
return new Promise((resolve, reject) => response.json()
|
||||
.then((json) => {
|
||||
if (!response.ok) {
|
||||
return reject(new StatusCodeError(response.status, json, { url, options }, response))
|
||||
}
|
||||
return resolve(json)
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue