diff --git a/server/routers/contentstack/loyaltyPage/utils.ts b/server/routers/contentstack/loyaltyPage/utils.ts index 1b473210a..54da06669 100644 --- a/server/routers/contentstack/loyaltyPage/utils.ts +++ b/server/routers/contentstack/loyaltyPage/utils.ts @@ -84,18 +84,19 @@ export function makeButtonObject(button: any) { const isContenstackLink = button?.is_contentstack_link || button.linkConnection?.edges?.length + const linkConnnectionNode = button.linkConnection.edges[0].node return { openInNewTab: button?.open_in_new_tab, title: button.cta_text || (isContenstackLink - ? button.linkConnection.edges[0].node.title + ? linkConnnectionNode.title : button.external_link.title), href: isContenstackLink - ? button.linkConnection.edges[0].node.web?.original_url || + ? linkConnnectionNode.web?.original_url || removeMultipleSlashes( - `/${button.linkConnection.edges[0].node.system.locale}/${button.linkConnection.edges[0].node.url}` + `/${linkConnnectionNode.system.locale}/${linkConnnectionNode.url}` ) : button.external_link.href, isExternal: !isContenstackLink,