Minor adjustments

This commit is contained in:
Taevas 2023-05-12 14:05:58 +02:00
parent fee3766c2b
commit 4f76b65fd4
4 changed files with 46 additions and 18 deletions

View file

@ -4,7 +4,8 @@ export async function api<T>(url: string): Promise<T> {
return fetch(url)
.then(response => {
if (!response.ok) {
throw new Error(response.statusText)
console.error(response.status, response.statusText)
throw new Error("Request failed :(")
}
return response.json() as Promise<T>
})