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:
@@ -2,10 +2,7 @@ import { z } from "zod"
|
||||
|
||||
import { DestinationOverviewPageEnum } from "../../../types/destinationOverviewPage"
|
||||
import { discriminatedUnionArray } from "../../../utils/discriminatedUnion"
|
||||
import {
|
||||
cardGalleryRefsSchema,
|
||||
cardGallerySchema,
|
||||
} from "../schemas/blocks/cardGallery"
|
||||
import { cardGallerySchema } from "../schemas/blocks/cardGallery"
|
||||
import { mapLocationSchema } from "../schemas/mapLocation"
|
||||
import { systemSchema } from "../schemas/system"
|
||||
|
||||
@@ -37,23 +34,3 @@ export const destinationOverviewPageSchema = z.object({
|
||||
url: z.string(),
|
||||
}),
|
||||
})
|
||||
|
||||
/** REFS */
|
||||
const destinationOverviewPageCardGalleryRef = z
|
||||
.object({
|
||||
__typename: z.literal(
|
||||
DestinationOverviewPageEnum.ContentStack.blocks.CardGallery
|
||||
),
|
||||
})
|
||||
.merge(cardGalleryRefsSchema)
|
||||
|
||||
const blocksRefsSchema = z.discriminatedUnion("__typename", [
|
||||
destinationOverviewPageCardGalleryRef,
|
||||
])
|
||||
|
||||
export const destinationOverviewPageRefsSchema = z.object({
|
||||
destination_overview_page: z.object({
|
||||
blocks: discriminatedUnionArray(blocksRefsSchema.options).nullable(),
|
||||
system: systemSchema,
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user