export function get (url) { return new Promise((resolve, reject) => { const xhr = new XMLHttpRequest() xhr.onload = () => { if (xhr.status >= 200 && xhr.status < 300) { resolve(xhr.responseText) } else { reject(new Error(xhr.statusText)) } } xhr.onerror = () => { reject(new Error('An error occurred whilst sending the response.')) } xhr.open('GET', url) xhr.send() }) }