Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issueid #223945 fix: When user is loggin out we are redirecting to Di… #125

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Assesment/Assesment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ export const ProfileHeader = ({
const handleLogout = () => {
localStorage.clear();
end({});
navigate("/Login");
navigate("/login");
};

const CustomIconButton = styled(IconButton)({
Expand Down
25 changes: 12 additions & 13 deletions src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
import * as reviews from "../views";

const routData = [
{
id: "route-001",
path: "/",
component: reviews.DiscoverStart,
requiresAuth: true,
},
{
id: "route-002",
path: "/discover",
Expand Down Expand Up @@ -40,7 +46,6 @@ const routData = [
component: reviews.AssesmentEnd,
requiresAuth: true,
},

{
id: "route-008",
path: "/level-page",
Expand All @@ -53,6 +58,12 @@ const routData = [
component: reviews.PracticeRedirectPage,
requiresAuth: true,
},
{
id: "route-010",
path: "/login",
component: reviews.LoginPage,
requiresAuth: false,
},
];
// add login route for test rig

Expand All @@ -61,12 +72,6 @@ const isLogin = process.env.REACT_APP_IS_IN_APP_AUTHORISATION === "true";

if (isLogin && !virtualId) {
routData.push(
{
id: "route-001",
path: "/",
component: reviews.LoginPage,
requiresAuth: true,
},
{
id: "route-000",
path: "*",
Expand All @@ -76,12 +81,6 @@ if (isLogin && !virtualId) {
);
} else {
routData.push(
{
id: "route-001",
path: "/",
component: reviews.DiscoverStart,
requiresAuth: false,
},
{
id: "route-000",
path: "*",
Expand Down
4 changes: 1 addition & 3 deletions src/views/AppContent/AppContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ const PrivateRoute = (props) => {
const navigate = useNavigate();
useEffect(() => {
if (!virtualId && props.requiresAuth) {
navigate("/");
navigate("/login");
ajinkyapandetekdi marked this conversation as resolved.
Show resolved Hide resolved
}
}, [virtualId]);

return <>{props.children}</>;
};
const AppContent = ({ routes }) => {
// const navigate = useNavigate();
// const location = useLocation();

return (
<Fragment>
Expand Down