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.
fix/aggregate-notification-settings
eugenijm 4 years ago
parent 18a1f5d62a
commit ed7310c04b

@ -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()
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))
})
})
}))
})
}

Loading…
Cancel
Save