* feat(SW-3516): Include partnerLoyaltyNumber on bookings - Added user context to BookingFlowProviders for user state management. - Updated booking input and output schemas to accommodate new user data. - Refactored booking mutation logic to include user-related information. - Improved type definitions for better TypeScript support across booking components. Approved-by: Anton Gunnarsson
19 lines
455 B
TypeScript
19 lines
455 B
TypeScript
import { useContext } from "react"
|
|
|
|
import {
|
|
BookingFlowContext,
|
|
type BookingFlowContextData,
|
|
} from "../bookingFlowContext"
|
|
|
|
export const useBookingFlowContext = (): BookingFlowContextData => {
|
|
const context = useContext(BookingFlowContext)
|
|
|
|
if (!context) {
|
|
throw new Error(
|
|
"useBookingFlowContext must be used within a BookingFlowContextProvider. Did you forget to use the provider in the consuming app?"
|
|
)
|
|
}
|
|
|
|
return context
|
|
}
|