feat: enhance stays with api data

This commit is contained in:
Christel Westerberg
2024-05-08 14:56:39 +02:00
parent 57fd59ebe2
commit 661a8019d3
18 changed files with 223 additions and 108 deletions
+6 -2
View File
@@ -20,10 +20,14 @@ const defaultOptions: RequestInit = {
export async function get(
endpoint: Endpoint,
options: RequestOptionsWithOutBody
options: RequestOptionsWithOutBody,
params?: URLSearchParams
) {
defaultOptions.method = "GET"
return fetch(`${env.API_BASEURL}/${endpoint}`, merge(defaultOptions, options))
const url = new URL(
`${env.API_BASEURL}/${endpoint}${params ? `?${params.toString()}` : ""}`
)
return fetch(url, merge(defaultOptions, options))
}
export async function patch(