Merged in feat/SW-1652-confirmation-page (pull request #1483)
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
This commit is contained in:
29
apps/scandic-web/providers/BookingConfirmationProvider.tsx
Normal file
29
apps/scandic-web/providers/BookingConfirmationProvider.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
"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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user