feat(BOOK-609): Using embedded url for assets instead of href since that is not updated when the asset is updated)
* feat(BOOK-609): Updated refs handling for assets inside content pages Approved-by: Linus Flood
This commit is contained in:
@@ -73,12 +73,15 @@ export const contentRefsSchema = z.object({
|
||||
.nullish()
|
||||
.transform((data) => {
|
||||
return data?.content?.embedded_itemsConnection.edges
|
||||
.filter(({ node }) => node.__typename !== ContentEnum.blocks.SysAsset)
|
||||
.map(({ node }) => {
|
||||
if ("system" in node) {
|
||||
return node.system
|
||||
switch (node.__typename) {
|
||||
case ContentEnum.blocks.SysAsset:
|
||||
return node.system && (node.permanent_url || node.url)
|
||||
? { system: node.system, url: node.permanent_url || node.url }
|
||||
: null
|
||||
default:
|
||||
return node.system
|
||||
}
|
||||
return null
|
||||
})
|
||||
.filter((node) => !!node)
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user