Merged in feat/rework-contentstack (pull request #3493)
Feat(SW-3708): refactor contentstack fetching (removing all refs) and cache invalidation * Remove all REFS * Revalidate correct language * PR fixes * PR fixes * Throw when errors from contentstack api Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -3,8 +3,7 @@ import { z } from "zod"
|
||||
import { logger } from "@scandic-hotels/common/logger"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import { systemSchema } from "../system"
|
||||
import { transformedVideoSchema, videoRefSchema } from "../video"
|
||||
import { transformedVideoSchema } from "../video"
|
||||
|
||||
const cardStyleSchema = z
|
||||
.string()
|
||||
@@ -86,32 +85,3 @@ export const videoCardSchema = z.object({
|
||||
}
|
||||
}),
|
||||
})
|
||||
|
||||
const videoCardRefSchema = z.object({
|
||||
video: videoRefSchema,
|
||||
system: systemSchema,
|
||||
})
|
||||
|
||||
export const videoCardRefsSchema = z.object({
|
||||
typename: z
|
||||
.literal(BlocksEnums.block.VideoCard)
|
||||
.default(BlocksEnums.block.VideoCard),
|
||||
video_card: z
|
||||
.object({
|
||||
video_cardConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: videoCardRefSchema,
|
||||
})
|
||||
),
|
||||
}),
|
||||
})
|
||||
.transform((data) => {
|
||||
const videoCard = data.video_cardConnection.edges[0]?.node
|
||||
if (!videoCard?.video) {
|
||||
return null
|
||||
}
|
||||
|
||||
return videoCard
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user