import fetch from "node-fetch" export async function api(url: string): Promise { return fetch(url) .then(response => { if (!response.ok) { console.error(response.status, response.statusText) throw new Error("Request failed :(") } return response.json() as Promise }) }