8000 fix: th redirect issue by shafin-deriv · Pull Request #446 · deriv-com/bot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: th redirect issue #446

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

Conversation

shafin-deriv
Copy link
Contributor

This pull request introduces several changes across multiple files to enhance functionality related to user country management, redirection logic, and Traders Hub links. The most significant updates include storing the user's country in localStorage, improving redirection logic based on the user's country, and refactoring the TradershubLink component to handle dynamic URLs.

User Country Management:

  • Added logic to store the user's country (authorize.country) in localStorage in both AuthWrapper.tsx and APIBase to make the country accessible across the application. ([[1]](https://github.com/deriv-com/bot/pull/446/files#diff-af63e738f04e9a6ee6aa4a007406f027572f6c9ba0d97b9dadc0f2e36d13521aR56), [[2]](https://github.com/deriv-com/bot/pull/446/files#diff-3b0931891357dd6358fa53dcd1ab528d4de6ec5e344c41956adbe694df9e4c89R187))
  • Updated clearAuthData in auth-utils.ts to remove the client.country entry from localStorage when clearing authentication data. ([src/utils/auth-utils.tsR15](https://github.com/deriv-com/bot/pull/446/files#diff-5ba545d290df6d6cdf65aeaa975c1a298851237b32144775e3468703ea548743R15))

Redirection Logic:

  • Modified shouldRedirectToTraderHub in traders-hub-redirect.ts to check if the user's country is in the enabled list from GrowthBook before redirecting. This ensures that redirection to the Traders Hub is country-specific. ([src/utils/traders-hub-redirect.tsL81-L84](https://github.com/deriv-com/bot/pull/446/files#diff-9e7ebbfc33380b8cdf202af9e5245d86a38c208dc40653c168d120e0d4dd8100L81-L84))

Traders Hub Link Refactoring:

  • Refactored the TradershubLink component in menu-items.tsx to use useState and useEffect for dynamically setting the redirection URL based on the user's wallet status and virtual account status. ([[1]](https://github.com/deriv-com/bot/pull/446/files#diff-dc0c6cabb80e41effb7d5b0d9206c0bc3325309eb780758d24a71edb434360b5R90-R95), [[2]](https://github.com/deriv-com/bot/pull/446/files#diff-dc0c6cabb80e41effb7d5b0d9206c0bc3325309eb780758d24a71edb434360b5L103))
  • Updated the href attribute of the MenuItem to use undefined as a fallback when the redirection URL is null, improving robustness. ([src/components/layout/header/menu-items/menu-items.tsxL128-R133](https://github.com/deriv-com/bot/pull/446/files#diff-dc0c6cabb80e41effb7d5b0d9206c0bc3325309eb780758d24a71edb434360b5L128-R133))

< 9CE4 /div>
Copy link

Preview Link: https://shafin-BOT-2922-fix1.bot-65f.pages.dev

Name Result
Build status Completed ✅
Preview URL Visit Preview
Action URL Visit Action

@shafin-deriv shafin-deriv merged commit 6179559 into deriv-com:master May 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0