feat: SW-2028 Updated validations at trpc query level

This commit is contained in:
Hrishikesh Vaipurkar
2025-03-25 14:28:52 +01:00
parent eda475d64e
commit 4f4e077859
8 changed files with 36 additions and 34 deletions

View File

@@ -44,7 +44,6 @@ function HotelCard({
state = "default",
type = HotelCardListingTypeEnum.PageListing,
bookingCode = "",
userPoints,
}: HotelCardProps) {
const params = useParams()
const lang = params.lang as Lang
@@ -74,13 +73,7 @@ function HotelCard({
availability.productType?.member?.rateType === RateTypeEnum.Regular
const price = availability.productType
const userHasEnoughPoints =
userPoints !== undefined
? !!price?.redemptions?.some(
(r) => r.localPrice.pointsPerStay < userPoints
)
: false
const userHasEnoughPoints = price?.redemptions?.some((r) => r.hasEnoughPoints)
const notEnoughPointsLabel = intl.formatMessage({ id: "Not enough points" })
return (
@@ -218,7 +211,7 @@ function HotelCard({
))}
</div>
) : null}
{userPoints !== undefined && !userHasEnoughPoints ? (
{price?.redemptions?.length && !userHasEnoughPoints ? (
<Tooltip
arrow="left"
position="bottom"