feat(SW-66, SW-348): search functionality and ui
This commit is contained in:
@@ -8,15 +8,17 @@ export namespace endpoints {
|
||||
}
|
||||
export const enum v1 {
|
||||
profile = "profile/v1/Profile",
|
||||
creditCards = `${profile}/creditCards`,
|
||||
initiateSaveCard = `${creditCards}/initiateSaveCard`,
|
||||
friendTransactions = "profile/v1/Transaction/friendTransactions",
|
||||
upcomingStays = "booking/v1/Stays/future",
|
||||
previousStays = "booking/v1/Stays/past",
|
||||
hotels = "hotel/v1/Hotels",
|
||||
intiateSaveCard = `${creditCards}/initiateSaveCard`,
|
||||
deleteCreditCard = `${profile}/creditCards`,
|
||||
booking = "booking/v1/Bookings",
|
||||
creditCards = `${profile}/creditCards`,
|
||||
city = "hotel/v1/Cities",
|
||||
citiesCountry = `${city}/country`,
|
||||
countries = "hotel/v1/Countries",
|
||||
friendTransactions = "profile/v1/Transaction/friendTransactions",
|
||||
hotels = "hotel/v1/Hotels",
|
||||
initiateSaveCard = `${creditCards}/initiateSaveCard`,
|
||||
locations = "hotel/v1/Locations",
|
||||
previousStays = "booking/v1/Stays/past",
|
||||
upcomingStays = "booking/v1/Stays/future",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const defaultOptions: RequestInit = {
|
||||
mode: "cors",
|
||||
}
|
||||
|
||||
const fetch = fetchRetry(global.fetch, {
|
||||
const wrappedFetch = fetchRetry(fetch, {
|
||||
retries: 3,
|
||||
retryDelay: function (attempt, error, response) {
|
||||
return Math.pow(2, attempt) * 150 // 150, 300, 600
|
||||
@@ -41,7 +41,10 @@ export async function get(
|
||||
})
|
||||
url.searchParams.sort()
|
||||
}
|
||||
return fetch(url, merge.all([defaultOptions, { method: "GET" }, options]))
|
||||
return wrappedFetch(
|
||||
url,
|
||||
merge.all([defaultOptions, { method: "GET" }, options])
|
||||
)
|
||||
}
|
||||
|
||||
export async function patch(
|
||||
@@ -59,7 +62,7 @@ export async function patch(
|
||||
})
|
||||
url.searchParams.sort()
|
||||
}
|
||||
return fetch(
|
||||
return wrappedFetch(
|
||||
url,
|
||||
merge.all([
|
||||
defaultOptions,
|
||||
@@ -84,7 +87,7 @@ export async function post(
|
||||
})
|
||||
url.searchParams.sort()
|
||||
}
|
||||
return fetch(
|
||||
return wrappedFetch(
|
||||
url,
|
||||
merge.all([
|
||||
defaultOptions,
|
||||
@@ -108,5 +111,8 @@ export async function remove(
|
||||
})
|
||||
url.searchParams.sort()
|
||||
}
|
||||
return fetch(url, merge.all([defaultOptions, { method: "DELETE" }, options]))
|
||||
return wrappedFetch(
|
||||
url,
|
||||
merge.all([defaultOptions, { method: "DELETE" }, options])
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user