fix: replace content_type_id with __typename

This commit is contained in:
Arvid Norlin
2024-02-14 11:15:52 +01:00
parent 5b3b47b568
commit 0556b509bc
4 changed files with 12 additions and 4 deletions

View File

@@ -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,

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -12,6 +12,10 @@ export enum BlocksTypenameEnum {
CurrentBlocksPageBlocksText = "CurrentBlocksPageBlocksText",
}
export enum PagesTypenameEnum {
CurrentBlocksPage = "CurrentBlocksPage",
}
export type BlocksTypename = keyof typeof BlocksTypenameEnum
export type Typename<T, K> = T & {