Merged in feat/SW-755-price-change-non-happy (pull request #957)
Feat/SW-755 price change non happy * fix(SW-755): dont show field error if checkbox has no children * feat(SW-755): Price change route + dialog WIP * fix(SW-755): minor refactoring * fix(SW-755): added logging to price change route * fix(SW-755): remove redundant search param logic * fix(SW-755): moved enum cast to zod instead * fix(SW-755): move prop type to types folder * fix(SW-755): Added suspense to Payment and refactored payment options hook * fix(SW-755): seperated terms and conditions copy from the checkbox label * fix(SW-755): add currency format and fixed wrong translation * fix(SW-755): change from undefined to null * fix(SW-755): added extra type safety to payment options Approved-by: Christian Andolf Approved-by: Simon.Emanuelsson
This commit is contained in:
@@ -59,6 +59,9 @@ export namespace endpoints {
|
||||
export function status(confirmationNumber: string) {
|
||||
return `${bookings}/${confirmationNumber}/status`
|
||||
}
|
||||
export function priceChange(confirmationNumber: string) {
|
||||
return `${bookings}/${confirmationNumber}/priceChange`
|
||||
}
|
||||
|
||||
export const enum Stays {
|
||||
future = `${base.path.booking}/${version}/${base.enitity.Stays}/future`,
|
||||
|
||||
@@ -34,13 +34,7 @@ export async function get(
|
||||
) {
|
||||
const url = new URL(env.API_BASEURL)
|
||||
url.pathname = endpoint
|
||||
const searchParams = new URLSearchParams(params)
|
||||
if (searchParams.size) {
|
||||
searchParams.forEach((value, key) => {
|
||||
url.searchParams.append(key, value)
|
||||
})
|
||||
url.searchParams.sort()
|
||||
}
|
||||
url.search = new URLSearchParams(params).toString()
|
||||
return wrappedFetch(
|
||||
url,
|
||||
merge.all([defaultOptions, { method: "GET" }, options])
|
||||
@@ -55,13 +49,7 @@ export async function patch(
|
||||
const { body, ...requestOptions } = options
|
||||
const url = new URL(env.API_BASEURL)
|
||||
url.pathname = endpoint
|
||||
const searchParams = new URLSearchParams(params)
|
||||
if (searchParams.size) {
|
||||
searchParams.forEach((value, key) => {
|
||||
url.searchParams.set(key, value)
|
||||
})
|
||||
url.searchParams.sort()
|
||||
}
|
||||
url.search = new URLSearchParams(params).toString()
|
||||
return wrappedFetch(
|
||||
url,
|
||||
merge.all([
|
||||
@@ -80,13 +68,7 @@ export async function post(
|
||||
const { body, ...requestOptions } = options
|
||||
const url = new URL(env.API_BASEURL)
|
||||
url.pathname = endpoint
|
||||
const searchParams = new URLSearchParams(params)
|
||||
if (searchParams.size) {
|
||||
searchParams.forEach((value, key) => {
|
||||
url.searchParams.set(key, value)
|
||||
})
|
||||
url.searchParams.sort()
|
||||
}
|
||||
url.search = new URLSearchParams(params).toString()
|
||||
return wrappedFetch(
|
||||
url,
|
||||
merge.all([
|
||||
@@ -97,6 +79,25 @@ export async function post(
|
||||
)
|
||||
}
|
||||
|
||||
export async function put(
|
||||
endpoint: Endpoint | `${Endpoint}/${string}`,
|
||||
options: RequestOptionsWithJSONBody,
|
||||
params = {}
|
||||
) {
|
||||
const { body, ...requestOptions } = options
|
||||
const url = new URL(env.API_BASEURL)
|
||||
url.pathname = endpoint
|
||||
url.search = new URLSearchParams(params).toString()
|
||||
return wrappedFetch(
|
||||
url,
|
||||
merge.all([
|
||||
defaultOptions,
|
||||
{ body: JSON.stringify(body), method: "PUT" },
|
||||
requestOptions,
|
||||
])
|
||||
)
|
||||
}
|
||||
|
||||
export async function remove(
|
||||
endpoint: Endpoint | `${Endpoint}/${string}`,
|
||||
options: RequestOptionsWithOutBody,
|
||||
@@ -104,13 +105,7 @@ export async function remove(
|
||||
) {
|
||||
const url = new URL(env.API_BASEURL)
|
||||
url.pathname = endpoint
|
||||
const searchParams = new URLSearchParams(params)
|
||||
if (searchParams.size) {
|
||||
searchParams.forEach((value, key) => {
|
||||
url.searchParams.set(key, value)
|
||||
})
|
||||
url.searchParams.sort()
|
||||
}
|
||||
url.search = new URLSearchParams(params).toString()
|
||||
return wrappedFetch(
|
||||
url,
|
||||
merge.all([defaultOptions, { method: "DELETE" }, options])
|
||||
|
||||
Reference in New Issue
Block a user