fix(SW-438): fix refs
This commit is contained in:
@@ -3,6 +3,7 @@ import { z } from "zod"
|
||||
import {
|
||||
teaserCardBlockRefsSchema,
|
||||
teaserCardBlockSchema,
|
||||
transformCardBlockRefs,
|
||||
transformTeaserCardBlock,
|
||||
} from "../blocks/cardsGrid"
|
||||
|
||||
@@ -15,7 +16,7 @@ export const contentCardsSchema = z.object({
|
||||
.default(SidebarEnums.blocks.ContentCard),
|
||||
content_card: z
|
||||
.object({
|
||||
theme: z.enum(["gray", "white"]).nullable().default("gray"),
|
||||
theme: z.enum(["featured", "default"]).nullable().default("default"),
|
||||
content_cardConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
@@ -33,13 +34,21 @@ export const contentCardsSchema = z.object({
|
||||
})
|
||||
|
||||
export const contentCardRefschema = z.object({
|
||||
content_card: z.object({
|
||||
content_cardConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: teaserCardBlockRefsSchema,
|
||||
})
|
||||
),
|
||||
content_card: z
|
||||
.object({
|
||||
content_cardConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: teaserCardBlockRefsSchema,
|
||||
})
|
||||
),
|
||||
}),
|
||||
})
|
||||
.transform((data) => {
|
||||
let card = null
|
||||
if (data.content_cardConnection.edges.length) {
|
||||
card = transformCardBlockRefs(data.content_cardConnection.edges[0].node)
|
||||
}
|
||||
return card
|
||||
}),
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user