Skip to content

Commit

Permalink
Merge pull request #199 from edx/revert-197-revert-172-azan/PROD-2554
Browse files Browse the repository at this point in the history
feat: add default redirect to v2
  • Loading branch information
DawoudSheraz authored Nov 23, 2021
2 parents bcd5552 + 88c008a commit 76d3b5c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/supportHeader/ToggleVersion.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext } from 'react';
import React, { useContext, useEffect } from 'react';
import { Form } from '@edx/paragon';
import { AppContext } from '@edx/frontend-platform/react';
import { TAB_PATH_MAP } from '../SupportToolsTab/constants';
Expand All @@ -20,6 +20,14 @@ export default function ToggleVersion() {
window.location.href = window.location.href.replace(config.BASE_URL, `${config.BASE_URL}/v2`);
}
};

useEffect(() => {
if (sessionStorage.getItem('redirect') === null) {
sessionStorage.setItem('redirect', 'false');
if (window.location.href.indexOf('/v2') === -1) { handleChange(); }
}
}, []);

return (
<Form.Check
type="switch"
Expand Down

0 comments on commit 76d3b5c

Please sign in to comment.