diff --git a/src/components/course/data/hooks.jsx b/src/components/course/data/hooks.jsx index f00d095f64..0da152e01f 100644 --- a/src/components/course/data/hooks.jsx +++ b/src/components/course/data/hooks.jsx @@ -299,9 +299,9 @@ export const useCourseEnrollmentUrl = ({ () => ({ next: `${config.LMS_BASE_URL}/courses/${courseRunKey}/course`, // Redirect back to the same page with a failure query param - failure_url: `${global.location.origin}${location.pathname}?${baseQueryParams.toString()}`, + failure_url: `${global.location.origin}${global.location.pathname}?${baseQueryParams.toString()}`, }), - [config.LMS_BASE_URL, courseRunKey, baseQueryParams, location.pathname], + [config.LMS_BASE_URL, courseRunKey, baseQueryParams], ); const enrollmentUrl = useMemo( diff --git a/src/components/course/data/utils.jsx b/src/components/course/data/utils.jsx index e95797200e..cfdfd5a1df 100644 --- a/src/components/course/data/utils.jsx +++ b/src/components/course/data/utils.jsx @@ -793,7 +793,7 @@ export const createEnrollFailureUrl = ({ courseRunKey, location }) => { baseQueryParams.set(ENROLLMENT_FAILED_QUERY_PARAM, true); baseQueryParams.set(ENROLLMENT_COURSE_RUN_KEY_QUERY_PARAM, courseRunKey); - return `${global.location.origin}${location.pathname}?${baseQueryParams.toString()}`; + return `${global.location.origin}${global.location.pathname}?${baseQueryParams.toString()}`; }; export const createEnrollWithLicenseUrl = ({