WIP: map CMS data to Tracking

This commit is contained in:
Arvid Norlin
2024-02-13 15:53:26 +01:00
parent 5bd162da10
commit 5b3b47b568
3 changed files with 25 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ import ContentPage from "@/components/Current/ContentPage"
import type { PageArgs, LangParams, UriParams } from "@/types/params" import type { PageArgs, LangParams, UriParams } from "@/types/params"
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage" import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
import Tracking from "../../Tracking"
export default async function CurrentContentPage({ export default async function CurrentContentPage({
params, params,
@@ -31,13 +32,24 @@ export default async function CurrentContentPage({
console.log("SearchParams URI: ", searchParams.uri) console.log("SearchParams URI: ", searchParams.uri)
throw new Error("Not found") 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 ( return (
<ContentPage <>
data={response.data} <ContentPage
uri={searchParams.uri} data={response.data}
lang={params.lang} uri={searchParams.uri}
/> lang={params.lang}
/>
<Tracking pageData={trackingData} />
</>
) )
} catch (err) { } catch (err) {
return notFound() return notFound()

View File

@@ -31,6 +31,8 @@ query GetCurrentBlockPage($locale: String!, $url: String!) {
system { system {
uid uid
content_type_uid content_type_uid
created_at
updated_at
} }
} }
total total

View File

@@ -48,6 +48,12 @@ export type BlockPage = {
preamble: Preamble preamble: Preamble
title: string title: string
url: 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 = { export type GetCurrentBlockPageData = {