Setup something simple and straight-forward
This commit is contained in:
parent
079f25673b
commit
5ec7cd193e
7 changed files with 85 additions and 4 deletions
10
netlify/functions/shared/api.ts
Normal file
10
netlify/functions/shared/api.ts
Normal 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>
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue