From 0556b509bc38a985b48931c5da39de058626b3bc Mon Sep 17 00:00:00 2001 From: Arvid Norlin Date: Wed, 14 Feb 2024 11:15:52 +0100 Subject: [PATCH] fix: replace content_type_id with __typename --- app/[lang]/(live)/current-content-page/page.tsx | 2 +- lib/graphql/Query/CurrentBlockPage.graphql | 2 +- types/requests/currentBlockPage.ts | 8 ++++++-- types/requests/utils/typename.ts | 4 ++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/[lang]/(live)/current-content-page/page.tsx b/app/[lang]/(live)/current-content-page/page.tsx index c3ed2654a..de9faf0e1 100644 --- a/app/[lang]/(live)/current-content-page/page.tsx +++ b/app/[lang]/(live)/current-content-page/page.tsx @@ -35,7 +35,7 @@ export default async function CurrentContentPage({ const pageData = response.data.all_current_blocks_page.items[0] const trackingData = { pageName: pageData.title, - pageType: pageData.system.content_type_uid, + pageType: pageData.__typename, publishedDate: pageData.system.updated_at, createdDate: pageData.system.created_at, pageId: pageData.system.uid, diff --git a/lib/graphql/Query/CurrentBlockPage.graphql b/lib/graphql/Query/CurrentBlockPage.graphql index 06f6968d4..8eebebb7a 100644 --- a/lib/graphql/Query/CurrentBlockPage.graphql +++ b/lib/graphql/Query/CurrentBlockPage.graphql @@ -10,6 +10,7 @@ query GetCurrentBlockPage($locale: String!, $url: String!) { all_current_blocks_page(limit: 1, locale: $locale, where: { url: $url }) { items { + __typename aside { __typename ...ContactAside @@ -30,7 +31,6 @@ query GetCurrentBlockPage($locale: String!, $url: String!) { url system { uid - content_type_uid created_at updated_at } diff --git a/types/requests/currentBlockPage.ts b/types/requests/currentBlockPage.ts index a4007f708..52a096880 100644 --- a/types/requests/currentBlockPage.ts +++ b/types/requests/currentBlockPage.ts @@ -8,7 +8,11 @@ import type { PuffBlock } from "./blocks/puff" import type { Preamble } from "./preamble" import type { Text } from "./blocks/text" import type { AllRequestResponse } from "./utils/all" -import type { AsideTypenameEnum, Typename } from "./utils/typename" +import type { + AsideTypenameEnum, + Typename, + PagesTypenameEnum, +} from "./utils/typename" import type { EmbedEnum } from "./utils/embeds" import type { Edges } from "./utils/edges" @@ -41,6 +45,7 @@ export type Breadcrumbs = { } export type BlockPage = { + __typename: PagesTypenameEnum.CurrentBlocksPage aside: Asides[] blocks: Blocks[] breadcrumbs: Breadcrumbs @@ -50,7 +55,6 @@ export type BlockPage = { url: string system: { uid: string - content_type_uid: string // should this be locked down to the specific enum? created_at: string updated_at: string } diff --git a/types/requests/utils/typename.ts b/types/requests/utils/typename.ts index ea9d03e94..2e9aaf74f 100644 --- a/types/requests/utils/typename.ts +++ b/types/requests/utils/typename.ts @@ -12,6 +12,10 @@ export enum BlocksTypenameEnum { CurrentBlocksPageBlocksText = "CurrentBlocksPageBlocksText", } +export enum PagesTypenameEnum { + CurrentBlocksPage = "CurrentBlocksPage", +} + export type BlocksTypename = keyof typeof BlocksTypenameEnum export type Typename = T & {