All files / utils http.js

25% Statements 3/12
0% Branches 0/7
0% Functions 0/3
25% Lines 3/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 192x                 2x             2x    
export const verifyStatus = response => {
  if (response.status >= 200 && response.status < 300) {
    return response;
  }
  const error = new Error(response.statusText);
  error.response = response;
  throw error;
};
 
export const parseJSON = response => {
  if (response.status !== 204) {
    return response.json();
  }
  return '{}';
};
 
export const makeRequest = (url, options = {}) =>
  fetch(url, options).then(verifyStatus).then(parseJSON);