WIP: map CMS data to Tracking
This commit is contained in:
@@ -7,6 +7,7 @@ import ContentPage from "@/components/Current/ContentPage"
|
||||
|
||||
import type { PageArgs, LangParams, UriParams } from "@/types/params"
|
||||
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
|
||||
import Tracking from "../../Tracking"
|
||||
|
||||
export default async function CurrentContentPage({
|
||||
params,
|
||||
@@ -31,13 +32,24 @@ export default async function CurrentContentPage({
|
||||
console.log("SearchParams URI: ", searchParams.uri)
|
||||
throw new Error("Not found")
|
||||
}
|
||||
const pageData = response.data.all_current_blocks_page.items[0]
|
||||
const trackingData = {
|
||||
pageName: pageData.title,
|
||||
pageType: pageData.system.content_type_uid,
|
||||
publishedDate: pageData.system.updated_at,
|
||||
createdDate: pageData.system.created_at,
|
||||
pageId: pageData.system.uid,
|
||||
}
|
||||
|
||||
return (
|
||||
<ContentPage
|
||||
data={response.data}
|
||||
uri={searchParams.uri}
|
||||
lang={params.lang}
|
||||
/>
|
||||
<>
|
||||
<ContentPage
|
||||
data={response.data}
|
||||
uri={searchParams.uri}
|
||||
lang={params.lang}
|
||||
/>
|
||||
<Tracking pageData={trackingData} />
|
||||
</>
|
||||
)
|
||||
} catch (err) {
|
||||
return notFound()
|
||||
|
||||
@@ -31,6 +31,8 @@ query GetCurrentBlockPage($locale: String!, $url: String!) {
|
||||
system {
|
||||
uid
|
||||
content_type_uid
|
||||
created_at
|
||||
updated_at
|
||||
}
|
||||
}
|
||||
total
|
||||
|
||||
@@ -48,6 +48,12 @@ export type BlockPage = {
|
||||
preamble: Preamble
|
||||
title: string
|
||||
url: string
|
||||
system: {
|
||||
uid: string
|
||||
content_type_uid: string // should this be locked down to the specific enum?
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
}
|
||||
|
||||
export type GetCurrentBlockPageData = {
|
||||
|
||||
Reference in New Issue
Block a user