fix: destructure attributes

This commit is contained in:
Chuma McPhoy
2024-07-08 12:47:55 +02:00
parent aff27f64a7
commit 753a379694

View File

@@ -15,27 +15,24 @@ export default async function HotelPage({ lang }: LangParams) {
return null return null
} }
const hotelPageData = await serverClient().hotel.getHotel({ const {
data: { attributes },
} = await serverClient().hotel.getHotel({
hotelId: hotelPageIdentifierData.hotel_page_id, hotelId: hotelPageIdentifierData.hotel_page_id,
language: lang, language: lang,
}) })
const hotelAttributes = hotelPageData.data.attributes
return ( return (
<main className={styles.pageContainer}> <main className={styles.pageContainer}>
<div className={styles.introContainer}> <div className={styles.introContainer}>
<IntroSection <IntroSection
hotelName={hotelAttributes.name} hotelName={attributes.name}
hotelDescription={ hotelDescription={attributes.hotelContent.texts.descriptions.short}
hotelAttributes.hotelContent.texts.descriptions.short location={attributes.location}
} address={attributes.address}
location={hotelAttributes.location} tripAdvisor={attributes.ratings.tripAdvisor}
address={hotelAttributes.address}
tripAdvisor={hotelAttributes.ratings.tripAdvisor}
/>
<AmenitiesList
detailedFacilities={hotelAttributes.detailedFacilities}
/> />
<AmenitiesList detailedFacilities={attributes.detailedFacilities} />
</div> </div>
</main> </main>
) )