import fetch from "unfetch" ; export function fetchJSON ( url , options ? ) { return fetch ( url , options ) . then ( checkStatus ) . then ( ( r ) => r . json ( ) ) ; } export function fetchHTML ( url , options ? ) { return fetch ( url , options ) . then ( ( r ) => r . text ( ) ) ; } function checkStatus ( response ) { if ( response . ok ) { return response ; } else { const error = new Error ( response . statusText ) ; error . response = response ; return Promise . reject ( error ) ; } }