diff --git a/src/alerts/enrollment-alert/hooks.js b/src/alerts/enrollment-alert/hooks.js index b5ddbb1d..7c6ec8dd 100644 --- a/src/alerts/enrollment-alert/hooks.js +++ b/src/alerts/enrollment-alert/hooks.js @@ -25,9 +25,9 @@ export function useEnrollmentAlert(courseId) { */ const isVisible = !enrolledUser && authenticatedUser !== null && privateOutline; const payload = { - canEnroll: outline ? outline.enrollAlert.canEnroll : false, + canEnroll: outline && outline.enrollAlert ? outline.enrollAlert.canEnroll : false, courseId, - extraText: outline ? outline.enrollAlert.extraText : '', + extraText: outline && outline.enrollAlert ? outline.enrollAlert.extraText : '', isStaff: course.isStaff, }; diff --git a/src/alerts/private-course-alert/hooks.js b/src/alerts/private-course-alert/hooks.js index 07d32a5d..24c7245b 100644 --- a/src/alerts/private-course-alert/hooks.js +++ b/src/alerts/private-course-alert/hooks.js @@ -20,7 +20,7 @@ export function usePrivateCourseAlert(courseId) { const isVisible = !enrolledUser && (privateOutline || authenticatedUser !== null); const payload = { anonymousUser: authenticatedUser === null, - canEnroll: outline ? outline.enrollAlert.canEnroll : false, + canEnroll: outline && outline.enrollAlert ? outline.enrollAlert.canEnroll : false, courseId, };