feat(SW-2265): Added campaign-page
Approved-by: Matilda Landström
This commit is contained in:
@@ -85,7 +85,21 @@ export const rawMetadataSchema = z.object({
|
||||
})
|
||||
.nullish(),
|
||||
heading: z.string().nullish(),
|
||||
preamble: z.string().nullish(),
|
||||
preamble: z
|
||||
.union([
|
||||
z.string(),
|
||||
z.object({
|
||||
first_column: z.string(),
|
||||
}),
|
||||
])
|
||||
.transform((preamble) => {
|
||||
if (typeof preamble === "string") {
|
||||
return preamble
|
||||
}
|
||||
|
||||
return preamble?.first_column || null
|
||||
})
|
||||
.nullish(),
|
||||
header: z
|
||||
.object({
|
||||
heading: z.string().nullish(),
|
||||
|
||||
@@ -2,6 +2,7 @@ import { cache } from "react"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
import { GetAccountPageMetadata } from "@/lib/graphql/Query/AccountPage/Metadata.graphql"
|
||||
import { GetCampaignPageMetadata } from "@/lib/graphql/Query/CampaignPage/Metadata.graphql"
|
||||
import { GetCollectionPageMetadata } from "@/lib/graphql/Query/CollectionPage/Metadata.graphql"
|
||||
import { GetContentPageMetadata } from "@/lib/graphql/Query/ContentPage/Metadata.graphql"
|
||||
import { GetDestinationCityPageMetadata } from "@/lib/graphql/Query/DestinationCityPage/Metadata.graphql"
|
||||
@@ -128,6 +129,14 @@ export const metadataQueryRouter = router({
|
||||
accountPageResponse.account_page
|
||||
)
|
||||
break
|
||||
case PageContentTypeEnum.campaignPage:
|
||||
const campaignPageResponse = await fetchMetadata<{
|
||||
campaign_page: RawMetadataSchema
|
||||
}>(GetCampaignPageMetadata, variables)
|
||||
metadata = await getTransformedMetadata(
|
||||
campaignPageResponse.campaign_page
|
||||
)
|
||||
break
|
||||
case PageContentTypeEnum.collectionPage:
|
||||
const collectionPageResponse = await fetchMetadata<{
|
||||
collection_page: RawMetadataSchema
|
||||
|
||||
Reference in New Issue
Block a user