lbry-desktop/ui/util/handle-fetch.js

5 lines
209 B
JavaScript
Raw Normal View History

2020-07-27 22:04:12 +02:00
// @flow
export default function handleFetchResponse(response: Response): Promise<any> {
2019-05-07 23:38:29 +02:00
return response.status === 200 ? Promise.resolve(response.json()) : Promise.reject(new Error(response.statusText));
2018-03-26 23:32:43 +02:00
}