Skip to content

Commit

Permalink
Added check to event-details page
Browse files Browse the repository at this point in the history
  • Loading branch information
egauzens committed Aug 21, 2024
1 parent ddf6a76 commit 398014b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pages/news-and-events/events/[eventId]/event-details/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{ heroSummary }}
</div>
</page-hero>
<div class="container pt-32">
<div v-if="eventDetailsItem" class="container pt-32">
<div class="subpage">
<div class="header mb-32">
<h2>Event Details</h2>
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 [
Expand Down

0 comments on commit 398014b

Please sign in to comment.