fix(SW-391): fixed issues with sidepeek functionality inside teaser cards

This commit is contained in:
Erik Tiekstra
2024-11-04 11:15:25 +01:00
parent 038ae1256f
commit dabdd597e2
5 changed files with 26 additions and 6 deletions

View File

@@ -91,7 +91,22 @@ export const teaserCardBlockSchema = z.object({
has_secondary_button: z.boolean().default(false),
secondary_button: buttonSchema,
})
.optional(),
.optional()
.transform((data) => {
if (!data) {
return undefined
}
return {
...data,
primary_button: data.has_primary_button
? data.primary_button
: undefined,
secondary_button: data.has_secondary_button
? data.secondary_button
: undefined,
}
}),
system: systemSchema,
})