refactor: infer types from zod validation
This commit is contained in:
@@ -3,12 +3,10 @@ import DynamicContentBlock from "@/components/Loyalty/Blocks/DynamicContent"
|
||||
|
||||
import CardGrid from "./CardGrid"
|
||||
|
||||
import {
|
||||
Blocks as BlocksType,
|
||||
LoyaltyBlocksTypenameEnum,
|
||||
} from "@/types/requests/loyaltyPage"
|
||||
import type { BlocksProps } from "@/types/components/loyalty/blocks"
|
||||
import { LoyaltyBlocksTypenameEnum } from "@/types/requests/loyaltyPage"
|
||||
|
||||
export function Blocks({ blocks }: { blocks: BlocksType[] }) {
|
||||
export function Blocks({ blocks }: BlocksProps) {
|
||||
return blocks.map((block) => {
|
||||
switch (block.__typename) {
|
||||
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksCardGrid:
|
||||
@@ -16,8 +14,8 @@ export function Blocks({ blocks }: { blocks: BlocksType[] }) {
|
||||
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksContent:
|
||||
return (
|
||||
<JsonToHtml
|
||||
nodes={block.content.json.children}
|
||||
embeds={block.content.embedded_itemsConnection.edges}
|
||||
nodes={block.content.content.json.children}
|
||||
embeds={block.content.content.embedded_itemsConnection.edges}
|
||||
/>
|
||||
)
|
||||
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksDynamicContent:
|
||||
|
||||
Reference in New Issue
Block a user