src/util/respToJson.js
/**
* Convert fetch result to json
* @param {Object} response fetch response object
* @return {Objcet} json data.
*/
export default function respToJson(response) {
if (!response.ok) {
throw Error(response.statusText);
}
return response.json();
}