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

Suisin/chore: fix redirection to dtrader everytime landing on home page after coming from smart trader #18120

Merged
Changes from all 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
10 changes: 9 additions & 1 deletion packages/trader/src/Modules/Trading/Containers/trade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const Trade = observer(() => {
is_dark_mode_on: is_dark_theme,
notification_messages_ui: NotificationMessages,
} = ui;
const { is_eu } = client;
const { is_eu, is_logged_in } = client;
const { network_status } = common;
const { isDesktop, isMobile, isTabletPortrait } = useDevice();

Expand Down Expand Up @@ -95,6 +95,14 @@ const Trade = observer(() => {
return null;
}, [try_synthetic_indices, try_open_markets, category, subcategory]);

React.useEffect(() => {
const has_session_storage = !!sessionStorage.getItem('tradershub_redirect_to');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[m] by right this should be placed on the logic when we are redirecting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't clear the sessionStorage when routing happen is because OIDC call back page depends on the sessionStorage route, if we remove it before we redirect them to Dtrader page, when OIDC kicks in, it will bring user back to the tradershub home page.


if (has_session_storage && is_logged_in) {
sessionStorage.removeItem('tradershub_redirect_to');
}
}, []);

React.useEffect(() => {
const html = document.querySelector('html');
if (isTabletPortrait && isTabletOs) {
Expand Down
Loading