asi-calculator/lib/fetch.ts

6 lines
154 B
TypeScript
Raw Normal View History

export async function fetcher(url: string) {
const res = await fetch(url)
if (!res.ok) throw new Error('Failed to fetch')
return await res.json()
}