Minor adjustments
This commit is contained in:
parent
fee3766c2b
commit
4f76b65fd4
4 changed files with 46 additions and 18 deletions
|
@ -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>
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue