Fix password reset confirmation redirection. (#61)

Fixed password reset redirection to dashboard page if user
is already logged in.

VAN-234
This commit is contained in:
Waheed Ahmed
2021-01-01 12:35:52 +05:00
committed by GitHub
parent c64b023235
commit 605968c903
7 changed files with 107 additions and 90 deletions

View File

@@ -0,0 +1,22 @@
import React from 'react';
import { Route } from 'react-router-dom';
import { AppContext } from '@edx/frontend-platform/react';
import { DEFAULT_REDIRECT_URL } from '../data/constants';
/**
* This wrapper redirects the requester to our default redirect url if they are
* already authenticated.
*/
const UnAuthOnlyRoute = (props) => {
const { authenticatedUser, config } = React.useContext(AppContext);
if (authenticatedUser) {
global.location.href = config.LMS_BASE_URL.concat(DEFAULT_REDIRECT_URL);
return null;
}
return <Route {...props} />;
};
export default UnAuthOnlyRoute;