feat: enhance stays with api data
This commit is contained in:
@@ -5,6 +5,10 @@ export namespace endpoints {
|
||||
export const enum v0 {
|
||||
profile = "profile/v0/Profile",
|
||||
}
|
||||
export const enum v1 {
|
||||
upcomingStays = "booking/v1/Stays/future",
|
||||
previousStays = "booking/v1/Stays/past",
|
||||
}
|
||||
}
|
||||
|
||||
export type Endpoint = endpoints.v0
|
||||
export type Endpoint = endpoints.v0 | endpoints.v1
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user