refactor: zod validation and pr comments
This commit is contained in:
@@ -31,6 +31,7 @@ export const loyaltyPageQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!validatedLoyaltyPage.success) {
|
||||
console.error(validatedLoyaltyPage.error)
|
||||
throw badRequestError()
|
||||
}
|
||||
|
||||
@@ -68,15 +69,13 @@ export const loyaltyPageQueryRouter = router({
|
||||
cards: block.card_grid.cards.map((card) => {
|
||||
return {
|
||||
...card,
|
||||
link:
|
||||
card.referenceConnection.totalCount > 0
|
||||
? {
|
||||
href: card.referenceConnection.edges[0].node
|
||||
.url,
|
||||
title:
|
||||
card.referenceConnection.edges[0].node.title,
|
||||
}
|
||||
: undefined,
|
||||
link: card.referenceConnection.totalCount
|
||||
? {
|
||||
href: card.referenceConnection.edges[0].node.url,
|
||||
title:
|
||||
card.referenceConnection.edges[0].node.title,
|
||||
}
|
||||
: undefined,
|
||||
}
|
||||
}),
|
||||
},
|
||||
@@ -86,17 +85,16 @@ export const loyaltyPageQueryRouter = router({
|
||||
...block,
|
||||
dynamic_content: {
|
||||
...block.dynamic_content,
|
||||
link:
|
||||
block.dynamic_content.link.pageConnection.totalCount > 0
|
||||
? {
|
||||
text: block.dynamic_content.link.text,
|
||||
href: block.dynamic_content.link.pageConnection
|
||||
.edges[0].node.url,
|
||||
title:
|
||||
block.dynamic_content.link.pageConnection.edges[0]
|
||||
.node.title,
|
||||
}
|
||||
: undefined,
|
||||
link: block.dynamic_content.link.pageConnection.totalCount
|
||||
? {
|
||||
text: block.dynamic_content.link.text,
|
||||
href: block.dynamic_content.link.pageConnection
|
||||
.edges[0].node.url,
|
||||
title:
|
||||
block.dynamic_content.link.pageConnection.edges[0]
|
||||
.node.title,
|
||||
}
|
||||
: undefined,
|
||||
},
|
||||
}
|
||||
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksContent:
|
||||
|
||||
Reference in New Issue
Block a user