feat(SW-201): Refactoring how we fetch hotel page data
This commit is contained in:
@@ -3,6 +3,7 @@ import { notFound } from "next/navigation"
|
||||
|
||||
import { isSignupPage } from "@/constants/routes/signup"
|
||||
import { env } from "@/env/server"
|
||||
import { getHotelPage } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import HotelPage from "@/components/ContentType/HotelPage"
|
||||
import LoyaltyPage from "@/components/ContentType/LoyaltyPage"
|
||||
@@ -19,7 +20,7 @@ import {
|
||||
|
||||
export { generateMetadata } from "@/utils/generateMetadata"
|
||||
|
||||
export default function ContentTypePage({
|
||||
export default async function ContentTypePage({
|
||||
params,
|
||||
}: PageArgs<LangParams & ContentTypeParams & UIDParams, {}>) {
|
||||
setLang(params.lang)
|
||||
@@ -57,7 +58,12 @@ export default function ContentTypePage({
|
||||
if (env.HIDE_FOR_NEXT_RELEASE) {
|
||||
return notFound()
|
||||
}
|
||||
return <HotelPage />
|
||||
const hotelPageData = await getHotelPage()
|
||||
return hotelPageData ? (
|
||||
<HotelPage hotelId={hotelPageData.hotel_page_id} />
|
||||
) : (
|
||||
notFound()
|
||||
)
|
||||
default:
|
||||
const type: never = params.contentType
|
||||
console.error(`Unsupported content type given: ${type}`)
|
||||
|
||||
Reference in New Issue
Block a user