sub-task: SW-685 Optimized params
This commit is contained in:
@@ -3,11 +3,11 @@ import { serverClient } from "@/lib/trpc/server"
|
|||||||
|
|
||||||
import BookingWidget, { preload } from "@/components/BookingWidget"
|
import BookingWidget, { preload } from "@/components/BookingWidget"
|
||||||
|
|
||||||
import { BookingWidgetPageProps } from "@/types/components/bookingWidget"
|
import { PageArgs } from "@/types/params"
|
||||||
|
|
||||||
export default async function BookingWidgetPage({
|
export default async function BookingWidgetPage({
|
||||||
searchParams,
|
searchParams,
|
||||||
}: BookingWidgetPageProps) {
|
}: PageArgs<{}, URLSearchParams>) {
|
||||||
if (env.HIDE_FOR_NEXT_RELEASE) {
|
if (env.HIDE_FOR_NEXT_RELEASE) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const bookingwidgetQueryRouter = router({
|
|||||||
const failedResponse = { hideBookingWidget: false }
|
const failedResponse = { hideBookingWidget: false }
|
||||||
const { contentType, uid, lang } = ctx
|
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) {
|
if (!contentType || !uid) {
|
||||||
console.log("No proper params defined: ", contentType, uid)
|
console.log("No proper params defined: ", contentType, uid)
|
||||||
return failedResponse
|
return failedResponse
|
||||||
|
|||||||
@@ -16,17 +16,12 @@ export type BookingWidgetSearchParams = {
|
|||||||
fromDate?: string
|
fromDate?: string
|
||||||
toDate?: string
|
toDate?: string
|
||||||
room?: GuestsRoom[]
|
room?: GuestsRoom[]
|
||||||
[key: string]: string | string[] | GuestsRoom[] | undefined
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BookingWidgetType = VariantProps<
|
export type BookingWidgetType = VariantProps<
|
||||||
typeof bookingWidgetVariants
|
typeof bookingWidgetVariants
|
||||||
>["type"]
|
>["type"]
|
||||||
|
|
||||||
export interface BookingWidgetPageProps {
|
|
||||||
searchParams?: URLSearchParams
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BookingWidgetProps {
|
export interface BookingWidgetProps {
|
||||||
type?: BookingWidgetType
|
type?: BookingWidgetType
|
||||||
searchParams?: URLSearchParams
|
searchParams?: URLSearchParams
|
||||||
|
|||||||
Reference in New Issue
Block a user