Merge branch 'develop' into feat/SW-266-seo-loyalty-pages

This commit is contained in:
Pontus Dreij
2024-08-21 14:11:53 +02:00
87 changed files with 2056 additions and 10893 deletions

View File

@@ -8,10 +8,11 @@ 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",
hotel = "hotel/v1/Hotels",
hotels = "hotel/v1/Hotels",
}
}

View File

@@ -7,7 +7,7 @@ import type {
RequestOptionsWithJSONBody,
RequestOptionsWithOutBody,
} from "@/types/fetch"
import type { Endpoint } from "./endpoints"
import type { Endpoint, endpoints } from "./endpoints"
export { endpoints } from "./endpoints"
@@ -27,7 +27,7 @@ const fetch = fetchRetry(global.fetch, {
})
export async function get(
endpoint: Endpoint,
endpoint: Endpoint | `${endpoints.v1.hotels}/${string}`,
options: RequestOptionsWithOutBody,
params?: URLSearchParams
) {
@@ -53,7 +53,7 @@ export async function patch(
}
export async function post(
endpoint: Endpoint,
endpoint: Endpoint | `${Endpoint}/${string}`,
options: RequestOptionsWithJSONBody
) {
const { body, ...requestOptions } = options