From 24384c08f3aa332a1c8aeda08b31d42b29aaa844 Mon Sep 17 00:00:00 2001 From: Hrishikesh Vaipurkar Date: Mon, 28 Oct 2024 12:04:17 +0100 Subject: [PATCH] sub-task: SW-685 Optimized params --- app/[lang]/(live)/@bookingwidget/page.tsx | 4 ++-- server/routers/contentstack/bookingwidget/query.ts | 2 +- types/components/bookingWidget/index.ts | 5 ----- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/[lang]/(live)/@bookingwidget/page.tsx b/app/[lang]/(live)/@bookingwidget/page.tsx index 2d43c7773..6c944ae69 100644 --- a/app/[lang]/(live)/@bookingwidget/page.tsx +++ b/app/[lang]/(live)/@bookingwidget/page.tsx @@ -3,11 +3,11 @@ import { serverClient } from "@/lib/trpc/server" import BookingWidget, { preload } from "@/components/BookingWidget" -import { BookingWidgetPageProps } from "@/types/components/bookingWidget" +import { PageArgs } from "@/types/params" export default async function BookingWidgetPage({ searchParams, -}: BookingWidgetPageProps) { +}: PageArgs<{}, URLSearchParams>) { if (env.HIDE_FOR_NEXT_RELEASE) { return null } diff --git a/server/routers/contentstack/bookingwidget/query.ts b/server/routers/contentstack/bookingwidget/query.ts index c8a64f20e..f87899965 100644 --- a/server/routers/contentstack/bookingwidget/query.ts +++ b/server/routers/contentstack/bookingwidget/query.ts @@ -26,7 +26,7 @@ export const bookingwidgetQueryRouter = router({ const failedResponse = { hideBookingWidget: false } const { contentType, uid, lang } = ctx - // This condition is to handle 404 page case + // This condition is to handle 404 page case and booking flow if (!contentType || !uid) { console.log("No proper params defined: ", contentType, uid) return failedResponse diff --git a/types/components/bookingWidget/index.ts b/types/components/bookingWidget/index.ts index a6230b0b2..c668617da 100644 --- a/types/components/bookingWidget/index.ts +++ b/types/components/bookingWidget/index.ts @@ -16,17 +16,12 @@ export type BookingWidgetSearchParams = { fromDate?: string toDate?: string room?: GuestsRoom[] - [key: string]: string | string[] | GuestsRoom[] | undefined } export type BookingWidgetType = VariantProps< typeof bookingWidgetVariants >["type"] -export interface BookingWidgetPageProps { - searchParams?: URLSearchParams -} - export interface BookingWidgetProps { type?: BookingWidgetType searchParams?: URLSearchParams