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:
@@ -17,29 +17,9 @@ export namespace StartPageEnum {
|
||||
|
||||
export interface StartPageRefs extends z.output<typeof startPageRefsSchema> {}
|
||||
|
||||
export function getConnectionsFromAssets({ start_page }: StartPageRefs) {
|
||||
const connections: AssetSystem["system"][] = []
|
||||
|
||||
if (start_page.blocks) {
|
||||
start_page.blocks.forEach((block) => {
|
||||
switch (block.__typename) {
|
||||
case StartPageEnum.ContentStack.blocks.VideoCard:
|
||||
if (block.video_card?.video.sourceConnection.edges[0]) {
|
||||
connections.push(
|
||||
block.video_card.video.sourceConnection.edges[0].node.system
|
||||
)
|
||||
}
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
return connections
|
||||
}
|
||||
|
||||
export function getConnections({ start_page }: StartPageRefs) {
|
||||
const connections: System["system"][] = [start_page.system]
|
||||
const assetConnections: AssetSystem[] = []
|
||||
|
||||
if (start_page.blocks) {
|
||||
start_page.blocks.forEach((block) => {
|
||||
@@ -75,6 +55,11 @@ export function getConnections({ start_page }: StartPageRefs) {
|
||||
if (block.video_card?.system) {
|
||||
connections.push(block.video_card.system)
|
||||
}
|
||||
if (block.video_card?.video.sourceConnection.edges[0]) {
|
||||
assetConnections.push(
|
||||
block.video_card.video.sourceConnection.edges[0].node
|
||||
)
|
||||
}
|
||||
break
|
||||
}
|
||||
default:
|
||||
@@ -84,5 +69,5 @@ export function getConnections({ start_page }: StartPageRefs) {
|
||||
})
|
||||
}
|
||||
|
||||
return connections
|
||||
return { connections, assetConnections }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user