Merged in fix/extended-page-link-schema (pull request #1241)
fix: handle optional web property in extended page link schema * fix: handle optional web property in page link transformation Approved-by: Christian Andolf
This commit is contained in:
@@ -25,9 +25,11 @@ export const accountPageRefSchema = z.object({
|
|||||||
|
|
||||||
export const extendedPageLinkSchema = pageLinkSchema.merge(
|
export const extendedPageLinkSchema = pageLinkSchema.merge(
|
||||||
z.object({
|
z.object({
|
||||||
web: z.object({
|
web: z
|
||||||
original_url: z.string().optional().default(""),
|
.object({
|
||||||
}),
|
original_url: z.string().optional().default(""),
|
||||||
|
})
|
||||||
|
.default({ original_url: "" }),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
export const collectionPageSchema = z
|
export const collectionPageSchema = z
|
||||||
@@ -167,7 +169,7 @@ export function transformPageLink(data: Data) {
|
|||||||
__typename: data.__typename,
|
__typename: data.__typename,
|
||||||
system: data.system,
|
system: data.system,
|
||||||
title: data.title,
|
title: data.title,
|
||||||
url: data.web.original_url
|
url: data.web?.original_url
|
||||||
? data.web.original_url
|
? data.web.original_url
|
||||||
: removeMultipleSlashes(`/${data.system.locale}/${data.url}`),
|
: removeMultipleSlashes(`/${data.system.locale}/${data.url}`),
|
||||||
web: data.web,
|
web: data.web,
|
||||||
|
|||||||
Reference in New Issue
Block a user