fix: cache hotel response

This commit is contained in:
Simon Emanuelsson
2024-12-17 16:18:46 +01:00
parent 13a164242f
commit 1deab000bd
38 changed files with 339 additions and 246 deletions

View File

@@ -22,9 +22,8 @@ export default async function BookingConfirmation({
confirmationNumber,
}: BookingConfirmationProps) {
const lang = getLang()
const { booking, hotel, room } = await getBookingConfirmation(
confirmationNumber
)
const { booking, hotel, room } =
await getBookingConfirmation(confirmationNumber)
const arrivalDate = new Date(booking.checkInDate)
const departureDate = new Date(booking.checkOutDate)

View File

@@ -2,7 +2,7 @@ import { z } from "zod"
import { dt } from "@/lib/dt"
import { phoneValidator } from "@/utils/phoneValidator"
import { phoneValidator } from "@/utils/zod/phoneValidator"
// stringMatcher regex is copied from current web as specified by requirements.
const stringMatcher =

View File

@@ -31,10 +31,6 @@ import {
type TrackingSDKPageData,
} from "@/types/components/tracking"
function isValidHotelData(hotel: NullableHotelData): hotel is HotelData {
return hotel != null
}
export async function SelectHotelMapContainer({
searchParams,
isAlternativeHotels,
@@ -89,7 +85,7 @@ export async function SelectHotelMapContainer({
const [hotels] = await fetchAvailableHotelsPromise
const validHotels = hotels?.filter(isValidHotelData) || []
const validHotels = (hotels?.filter(Boolean) as HotelData[]) || []
const hotelPins = getHotelPins(validHotels)
const filterList = getFiltersFromHotels(validHotels)

View File

@@ -66,7 +66,7 @@ export default async function HotelInfoCard({
{
address: hotel.address.streetAddress,
city: hotel.address.city,
distanceToCityCentreInKm: getSingleDecimal(
distanceToCityCenterInKm: getSingleDecimal(
hotel.location.distanceToCentre / 1000
),
}

View File

@@ -12,13 +12,13 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import styles from "./selectedRoomPanel.module.css"
import type { Room } from "@/types/components/hotelReservation/selectRate/selectRate"
import type { RoomData } from "@/types/hotel"
import type { Room as SelectedRateRoom } from "@/types/components/hotelReservation/selectRate/selectRate"
import type { Room } from "@/types/hotel"
interface SelectedRoomPanelProps {
roomIndex: number
room: Room
roomCategories: RoomData[]
room: SelectedRateRoom
roomCategories: Room[]
}
export default function SelectedRoomPanel({