feat(SW-66, SW-348): search functionality and ui

This commit is contained in:
Simon Emanuelsson
2024-08-28 10:47:57 +02:00
parent b9dbcf7d90
commit af850c90e7
437 changed files with 7663 additions and 9881 deletions

View File

@@ -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",
}
}

View File

@@ -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])
)
}