fix: refactor tracking requests
This commit is contained in:
@@ -11,14 +11,14 @@ import styles from "./loyaltyPage.module.css"
|
||||
import type { LangParams } from "@/types/params"
|
||||
|
||||
export default async function LoyaltyPage({ lang }: LangParams) {
|
||||
const loyaltyPage = await serverClient().contentstack.loyaltyPage.get()
|
||||
const loyaltyPageRes = await serverClient().contentstack.loyaltyPage.get()
|
||||
|
||||
if (!loyaltyPage) {
|
||||
if (!loyaltyPageRes) {
|
||||
return null
|
||||
}
|
||||
|
||||
const loyaltyPageTracking = serverClient().contentstack.loyaltyPage.tracking()
|
||||
const userTracking = serverClient().user.tracking()
|
||||
const { tracking, loyaltyPage } = loyaltyPageRes
|
||||
|
||||
return (
|
||||
<section className={styles.content}>
|
||||
{loyaltyPage.sidebar.length ? (
|
||||
@@ -31,10 +31,7 @@ export default async function LoyaltyPage({ lang }: LangParams) {
|
||||
<Blocks blocks={loyaltyPage.blocks} lang={lang} />
|
||||
) : null}
|
||||
</MaxWidth>
|
||||
<TrackingSDK
|
||||
pageDataPromise={loyaltyPageTracking}
|
||||
userDataPromise={userTracking}
|
||||
/>
|
||||
<TrackingSDK pageData={tracking} />
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user