41 lines
972 B
TypeScript
41 lines
972 B
TypeScript
import Title from "@/components/Title"
|
|
import MaxWidth from "@/components/MaxWidth"
|
|
|
|
import { serverClient } from "@/lib/trpc/server"
|
|
import { LangParams, PageArgs, UriParams } from "@/types/params"
|
|
import { notFound } from "next/navigation"
|
|
|
|
import styles from "./page.module.css"
|
|
|
|
export default async function LoyaltyPage({
|
|
params,
|
|
searchParams,
|
|
}: PageArgs<LangParams, UriParams>) {
|
|
try {
|
|
if (!searchParams.uri) {
|
|
throw new Error("Bad URI")
|
|
}
|
|
|
|
const loyaltyPage = await serverClient().contentstack.loyaltyPage.get({
|
|
uri: searchParams.uri,
|
|
lang: params.lang,
|
|
})
|
|
|
|
return (
|
|
<main className={styles.content}>
|
|
<aside>{loyaltyPage.sidebar ? <></> : null}</aside>
|
|
<MaxWidth>
|
|
<Title>{loyaltyPage.title}</Title>
|
|
<Content content={loyaltyPage.content} />
|
|
</MaxWidth>
|
|
</main>
|
|
)
|
|
} catch (err) {
|
|
return notFound()
|
|
}
|
|
}
|
|
|
|
function Content(content: any) {
|
|
return <></>
|
|
}
|