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

@@ -10,7 +10,7 @@ import {
} from "@/types/components/hotelPage/sidepeek/parking"
export default async function ParkingPrices({
currency,
currency = "",
freeParking,
pricing,
}: ParkingPricesProps) {

View File

@@ -125,10 +125,10 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
const trackingPageData = getTrackingPageData(
hotelPageData.system,
hotelData.data.attributes,
hotelData.hotel,
lang
)
const trackingHotelData = getTrackingHotelData(hotelData.data)
const trackingHotelData = getTrackingHotelData(hotelData.hotel)
return (
<div className={styles.pageContainer}>

View File

@@ -35,7 +35,7 @@ export function getTrackingPageData(
return tracking
}
export function getTrackingHotelData(hotelData: HotelData["data"]) {
export function getTrackingHotelData(hotelData: HotelData["hotel"]) {
const tracking: TrackingSDKHotelInfo = {
hotelID: hotelData.id,
}

View File

@@ -1,7 +1,7 @@
import { z } from "zod"
import { passwordValidator } from "@/utils/passwordValidator"
import { phoneValidator } from "@/utils/phoneValidator"
import { passwordValidator } from "@/utils/zod/passwordValidator"
import { phoneValidator } from "@/utils/zod/phoneValidator"
const countryRequiredMsg = "Country is required"
export const editProfileSchema = z

View File

@@ -1,7 +1,7 @@
import { z } from "zod"
import { passwordValidator } from "@/utils/passwordValidator"
import { phoneValidator } from "@/utils/phoneValidator"
import { passwordValidator } from "@/utils/zod/passwordValidator"
import { phoneValidator } from "@/utils/zod/phoneValidator"
const countryRequiredMsg = "Country is required"
export const signUpSchema = z.object({

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({

View File

@@ -14,7 +14,7 @@ import {
} from "@/components/Icons"
import AriaInputWithLabel from "@/components/TempDesignSystem/Form/Input/AriaInputWithLabel"
import Caption from "@/components/TempDesignSystem/Text/Caption"
import { passwordValidators } from "@/utils/passwordValidator"
import { passwordValidators } from "@/utils/zod/passwordValidator"
import Button from "../../Button"
import { type IconProps, type NewPasswordProps } from "./newPassword"