feat(SW-1386): add full width campaign to start page
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { StartPageEnum } from "@/types/enums/startPage"
|
||||
import type { System } from "@/types/requests/system"
|
||||
import type { StartPageRefs } from "@/types/trpc/routers/contentstack/startPage"
|
||||
|
||||
export function getConnections({ start_page }: StartPageRefs) {
|
||||
const connections: System["system"][] = [start_page.system]
|
||||
|
||||
if (start_page.blocks) {
|
||||
start_page.blocks.forEach((block) => {
|
||||
switch (block.__typename) {
|
||||
case StartPageEnum.ContentStack.blocks.FullWidthCampaign: {
|
||||
block.full_width_campaign.full_width_campaignConnection.edges.forEach(
|
||||
({ node }) => {
|
||||
connections.push(node.system)
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return connections
|
||||
}
|
||||
Reference in New Issue
Block a user