feat: SW-2028 Points validation redemption city search

This commit is contained in:
Hrishikesh Vaipurkar
2025-03-24 16:35:09 +01:00
parent 779495017e
commit eda475d64e
12 changed files with 71 additions and 16 deletions

View File

@@ -246,6 +246,14 @@ export async function getHotels(
return hotels
}
export async function getUserPoints() {
const membershipCard = await serverClient().user.safeMembershipLevel()
if (!membershipCard) {
return undefined
}
return membershipCard.currentPoints
}
const hotelSurroundingsFilterNames = [
"Hotel surroundings",
"Hotel omgivelser",

View File

@@ -23,7 +23,7 @@ import { convertObjToSearchParams } from "@/utils/url"
import HotelCardListing from "../HotelCardListing"
import BookingCodeFilter from "./BookingCodeFilter"
import { getFiltersFromHotels, getHotels } from "./helpers"
import { getFiltersFromHotels, getHotels, getUserPoints } from "./helpers"
import HotelCount from "./HotelCount"
import HotelFilter from "./HotelFilter"
import HotelSorter from "./HotelSorter"
@@ -76,6 +76,11 @@ export default async function SelectHotel({
!!redemption
)
let userPoints
if (redemption) {
userPoints = await getUserPoints()
}
const arrivalDate = new Date(selectHotelParams.fromDate)
const departureDate = new Date(selectHotelParams.toDate)
@@ -247,7 +252,10 @@ export default async function SelectHotel({
isAllUnavailable={isAllUnavailable}
operaId={hotels?.[0]?.hotel.operaId}
/>
<HotelCardListing hotelData={hotels} />
<HotelCardListing
hotelData={hotels}
userPoints={userPoints ? userPoints : undefined}
/>
</div>
</main>
<Suspense key={`${suspenseKey}-tracking`} fallback={null}>