fix: retain query params in authenticated user redirection (#1288)

This commit is contained in:
Syed Sajjad Hussain Shah
2024-07-29 11:23:48 +05:00
committed by GitHub
parent 9a30f053c7
commit 4755540be8

View File

@@ -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;
}