From 398014baf14376ef704962bd47be4789e0e16ae3 Mon Sep 17 00:00:00 2001 From: Eric Gauzens Date: Wed, 21 Aug 2024 18:05:20 -0400 Subject: [PATCH] Added check to event-details page --- .../events/[eventId]/event-details/index.vue | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pages/news-and-events/events/[eventId]/event-details/index.vue b/pages/news-and-events/events/[eventId]/event-details/index.vue index 048639b8..e2a9c6ab 100644 --- a/pages/news-and-events/events/[eventId]/event-details/index.vue +++ b/pages/news-and-events/events/[eventId]/event-details/index.vue @@ -15,7 +15,7 @@ {{ heroSummary }} -
+

Event Details

@@ -62,12 +62,11 @@ export default { async setup() { const route = useRoute() - const router = useRouter() try { const page = await getEventPage(route.params.eventId) - const eventDetailsItem = pathOr(null, ['fields','eventDetails'], page) - if (isEmpty(eventDetailsItem)) { - router.push(`/news-and-events/events/${route.params.eventId}`) + const eventDetailsItem = pathOr(null, ['fields', 'eventDetails'], page) + if (isEmpty(eventDetailsItem) || eventDetailsItem == null) { + navigateTo(`/news-and-events/events/${route.params.eventId}`, { redirectCode: 301 }) } return { page, @@ -115,8 +114,8 @@ export default { * Compute and convert the date the article was created * @returns {String} */ - updatedDate: function() { - return format(parseISO(this.eventDetailsItem.sys.updatedAt), 'MM/dd/yyyy') + updatedDate: function () { + return this.eventDetailsItem ? format(parseISO(this.eventDetailsItem?.sys.updatedAt), 'MM/dd/yyyy') : undefined }, breadcrumb: function() { return [