Setup something simple and straight-forward

This commit is contained in:
Taevas 2023-05-07 02:13:48 +02:00
parent 079f25673b
commit 5ec7cd193e
7 changed files with 85 additions and 4 deletions

View file

@ -0,0 +1,10 @@
// Standard variation
export async function api<T>(url: string): Promise<T> {
return fetch(url)
.then(response => {
if (!response.ok) {
throw new Error(response.statusText)
}
return response.json() as Promise<T>
})
}