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

[P2PS] Nada/4206/email verification redirection #17253

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 12 additions & 2 deletions packages/p2p/src/pages/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import './app.scss';

const App = () => {
const is_production = window.location.origin === URLConstants.derivAppProduction;

const [is_p2p_standalone_enabled, isGBLoaded] = useGrowthbookGetFeatureValue({
featureFlag: 'p2p_standalone_enabled',
defaultValue: false,
Expand Down Expand Up @@ -48,10 +49,19 @@ const App = () => {
React.useEffect(() => {
if (isGBLoaded) {
if (is_p2p_standalone_enabled) {
window.location.href = is_production ? URLConstants.derivP2pProduction : URLConstants.derivP2pStaging;
const target_url = is_production ? URLConstants.derivP2pProduction : URLConstants.derivP2pStaging;
if (action_param === 'p2p_order_confirm' && code_param) {
const current_url = window.location.href;
const split_url = current_url.split('/p2p')[1] || '';
const search_params = new URLSearchParams(split_url.split('?')[1]);
const order_id = search_params.get('order');
window.location.href = `${target_url}/redirect/p2p?action=${action_param}&order_id=${order_id}&code=${code_param}&lang=${lang}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

where are we handling the redirection from deriv-app to p2p?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.

} else {
window.location.href = target_url;
}
}
}
}, [isGBLoaded, is_p2p_standalone_enabled, is_production]);
}, [isGBLoaded, is_p2p_standalone_enabled, is_production, action_param, code_param, lang]);

React.useEffect(() => {
init();
Expand Down
Loading