From 4432cdc245d3e68c3895f3a4b67bce276ef80154 Mon Sep 17 00:00:00 2001 From: Michael Zetterberg Date: Tue, 6 May 2025 07:32:48 +0200 Subject: [PATCH] fix: booking widget search type --- .../(confirmation)/booking-confirmation/page.tsx | 2 +- apps/scandic-web/components/Forms/BookingWidget/index.tsx | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(confirmation)/booking-confirmation/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(confirmation)/booking-confirmation/page.tsx index 02e02ee81..0a38ba25a 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(confirmation)/booking-confirmation/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(confirmation)/booking-confirmation/page.tsx @@ -1,11 +1,11 @@ import { notFound } from "next/navigation" +import { MEMBERSHIP_FAILED_ERROR } from "@/constants/booking" import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests" import BookingConfirmation from "@/components/HotelReservation/BookingConfirmation" import type { LangParams, PageArgs } from "@/types/params" -import { MEMBERSHIP_FAILED_ERROR } from "@/constants/booking" export default async function BookingConfirmationPage({ searchParams, diff --git a/apps/scandic-web/components/Forms/BookingWidget/index.tsx b/apps/scandic-web/components/Forms/BookingWidget/index.tsx index 79cf4887e..ed75c18a2 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/index.tsx +++ b/apps/scandic-web/components/Forms/BookingWidget/index.tsx @@ -36,14 +36,12 @@ export default function Form({ type, onClose }: BookingWidgetFormProps) { const { handleSubmit, setValue } = useFormContext() function onSubmit(data: BookingWidgetSchema) { - const type = data.city && data.hotel ? "hotel" : "city" - - const bookingFlowPage = - type === "city" ? selectHotel(lang) : selectRate(lang) + const bookingFlowPage = data.hotel ? selectRate(lang) : selectHotel(lang) const bookingWidgetParams = convertObjToSearchParams({ rooms: data.rooms, ...data.date, - ...(type === "city" ? { city: data.city } : { hotel: data.hotel }), + ...(data.city ? { city: data.city } : {}), + ...(data.hotel ? { hotel: data.hotel } : {}), ...(data.bookingCode?.value ? { bookingCode: data.bookingCode.value } : {}),