Feat/SW-1652 confirmation page * feat(SW-1652): handle linkedReservations fetching * fix: add missing translations * feat: add linkedReservation retry functionality * chore: align naming Approved-by: Simon.Emanuelsson
30 lines
861 B
TypeScript
30 lines
861 B
TypeScript
"use client"
|
|
|
|
import { useRef } from "react"
|
|
|
|
import { createBookingConfirmationStore } from "@/stores/booking-confirmation"
|
|
|
|
import { BookingConfirmationContext } from "@/contexts/BookingConfirmation"
|
|
|
|
import type { BookingConfirmationStore } from "@/types/contexts/booking-confirmation"
|
|
import type { BookingConfirmationProviderProps } from "@/types/providers/booking-confirmation"
|
|
|
|
export default function BookingConfirmationProvider({
|
|
children,
|
|
currencyCode,
|
|
rooms,
|
|
}: BookingConfirmationProviderProps) {
|
|
const storeRef = useRef<BookingConfirmationStore>()
|
|
|
|
if (!storeRef.current) {
|
|
const initialData = { rooms, currencyCode }
|
|
storeRef.current = createBookingConfirmationStore(initialData)
|
|
}
|
|
|
|
return (
|
|
<BookingConfirmationContext.Provider value={storeRef.current}>
|
|
{children}
|
|
</BookingConfirmationContext.Provider>
|
|
)
|
|
}
|