Merged in fix/change-ref-id-to-query-param (pull request #1578)
fix: my stay now uses ref id in query param rather than path param to support legacy * fix: my stay now uses ref id in query param rather than path param to support legacy Approved-by: Michael Zetterberg
This commit is contained in:
committed by
Linus Flood
parent
3efa303d20
commit
7ddca4acba
@@ -24,7 +24,7 @@ export default async function GuaranteePaymentCallbackPage({
|
|||||||
const status = searchParams.status
|
const status = searchParams.status
|
||||||
const confirmationNumber = searchParams.confirmationNumber
|
const confirmationNumber = searchParams.confirmationNumber
|
||||||
const refId = searchParams.refId
|
const refId = searchParams.refId
|
||||||
const myStayUrl = `${hotelreservation(lang)}/my-stay/${encodeURIComponent(refId)}`
|
const myStayUrl = `${hotelreservation(lang)}/my-stay?RefId=${refId}`
|
||||||
|
|
||||||
if (status === "success" && confirmationNumber && refId) {
|
if (status === "success" && confirmationNumber && refId) {
|
||||||
console.log(`[gla-payment-callback] redirecting to: ${myStayUrl}`)
|
console.log(`[gla-payment-callback] redirecting to: ${myStayUrl}`)
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
|
||||||
|
|
||||||
export default function Loading() {
|
|
||||||
return <LoadingSpinner fullPage />
|
|
||||||
}
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { MyStaySkeleton as default } from "@/components/HotelReservation/MyStay/myStaySkeleton"
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { notFound } from "next/navigation"
|
||||||
import { Suspense } from "react"
|
import { Suspense } from "react"
|
||||||
|
|
||||||
import { MyStay } from "@/components/HotelReservation/MyStay"
|
import { MyStay } from "@/components/HotelReservation/MyStay"
|
||||||
@@ -6,11 +7,15 @@ import { MyStaySkeleton } from "@/components/HotelReservation/MyStay/myStaySkele
|
|||||||
import type { LangParams, PageArgs } from "@/types/params"
|
import type { LangParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
export default async function MyStayPage({
|
export default async function MyStayPage({
|
||||||
params,
|
searchParams,
|
||||||
}: PageArgs<LangParams & { refId: string }>) {
|
}: PageArgs<LangParams, { RefId?: string }>) {
|
||||||
|
if (!searchParams.RefId) {
|
||||||
|
notFound()
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={<MyStaySkeleton />}>
|
<Suspense fallback={<MyStaySkeleton />}>
|
||||||
<MyStay refId={decodeURIComponent(params.refId)} />
|
<MyStay refId={searchParams.RefId} />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ import { FormProvider, useForm } from "react-hook-form"
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { customerService } from "@/constants/currentWebHrefs"
|
import { customerService } from "@/constants/currentWebHrefs"
|
||||||
|
import { hotelreservation } from "@/constants/routes/hotelReservation"
|
||||||
import { trpc } from "@/lib/trpc/client"
|
import { trpc } from "@/lib/trpc/client"
|
||||||
|
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
@@ -43,9 +44,7 @@ export default function FindMyBooking() {
|
|||||||
const values = form.getValues()
|
const values = form.getValues()
|
||||||
const value = new URLSearchParams(values).toString()
|
const value = new URLSearchParams(values).toString()
|
||||||
document.cookie = `bv=${encodeURIComponent(value)}; Path=/; Max-Age=600; Secure; SameSite=Strict`
|
document.cookie = `bv=${encodeURIComponent(value)}; Path=/; Max-Age=600; Secure; SameSite=Strict`
|
||||||
router.push(
|
router.push(`${hotelreservation(lang)}/my-stay?RefId=${result.refId}`)
|
||||||
`/${lang}/hotelreservation/my-stay/${encodeURIComponent(result.refId)}`
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
console.error("Failed to create ref id", error)
|
console.error("Failed to create ref id", error)
|
||||||
|
|||||||
Reference in New Issue
Block a user