feat(SW-2622): pass language to guarantee booking
This commit is contained in:
@@ -4,6 +4,8 @@ import { useRef } from "react"
|
||||
|
||||
import { trpc } from "@/lib/trpc/client"
|
||||
|
||||
import useLang from "@/hooks/useLang"
|
||||
|
||||
import type { BookingStatusEnum } from "@/constants/booking"
|
||||
|
||||
export function useHandleBookingStatus({
|
||||
@@ -19,10 +21,14 @@ export function useHandleBookingStatus({
|
||||
retryInterval: number
|
||||
enabled: boolean
|
||||
}) {
|
||||
const lang = useLang()
|
||||
const retries = useRef(0)
|
||||
|
||||
const query = trpc.booking.status.useQuery(
|
||||
{ refId: refId ?? "" },
|
||||
{
|
||||
lang,
|
||||
refId: refId ?? "",
|
||||
},
|
||||
{
|
||||
enabled,
|
||||
refetchInterval: (query) => {
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
safeProtectedServiceProcedure,
|
||||
serviceProcedure,
|
||||
} from "@/server/trpc"
|
||||
import { toApiLang } from "@/server/utils"
|
||||
|
||||
import { getBookedHotelRoom } from "@/utils/booking"
|
||||
|
||||
@@ -207,8 +208,10 @@ export const bookingQueryRouter = router({
|
||||
status: serviceProcedure
|
||||
.input(getBookingStatusInput)
|
||||
.concat(refIdPlugin.toConfirmationNumber)
|
||||
.query(async function ({ ctx }) {
|
||||
.query(async function ({ ctx, input }) {
|
||||
const lang = input.lang ?? ctx.lang
|
||||
const { confirmationNumber } = ctx
|
||||
const language = toApiLang(lang)
|
||||
|
||||
const getBookingStatusCounter = createCounter("trpc.booking", "status")
|
||||
const metricsGetBookingStatus = getBookingStatusCounter.init({
|
||||
@@ -223,6 +226,9 @@ export const bookingQueryRouter = router({
|
||||
headers: {
|
||||
Authorization: `Bearer ${ctx.serviceToken}`,
|
||||
},
|
||||
},
|
||||
{
|
||||
language,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user