From 4755540be8f345edfd6a22859860c54b820699ab Mon Sep 17 00:00:00 2001 From: Syed Sajjad Hussain Shah <52817156+syedsajjadkazmii@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:23:48 +0500 Subject: [PATCH] fix: retain query params in authenticated user redirection (#1288) --- src/common-components/UnAuthOnlyRoute.jsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common-components/UnAuthOnlyRoute.jsx b/src/common-components/UnAuthOnlyRoute.jsx index 7be62aae..3e05fe0b 100644 --- a/src/common-components/UnAuthOnlyRoute.jsx +++ b/src/common-components/UnAuthOnlyRoute.jsx @@ -4,9 +4,7 @@ import { getConfig } from '@edx/frontend-platform'; import { fetchAuthenticatedUser, getAuthenticatedUser } from '@edx/frontend-platform/auth'; import PropTypes from 'prop-types'; -import { - DEFAULT_REDIRECT_URL, -} from '../data/constants'; +import { updatePathWithQueryParams } from '../data/utils'; /** * This wrapper redirects the requester to our default redirect url if they are @@ -25,7 +23,8 @@ const UnAuthOnlyRoute = ({ children }) => { if (isReady) { if (authUser && authUser.username) { - global.location.href = getConfig().LMS_BASE_URL.concat(DEFAULT_REDIRECT_URL); + const updatedPath = updatePathWithQueryParams(window.location.pathname); + global.location.href = getConfig().LMS_BASE_URL.concat(updatedPath); return null; }