File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
packages/blockchain-wallet-v4-frontend/src/scenes/Refer/Sofi Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 11import React , { useEffect } from 'react'
2- import { RouteComponentProps } from 'react-router-dom'
2+ import { useHistory , useLocation } from 'react-router-dom'
3+
4+ const SofiReferralComponent : React . FC = ( ) => {
5+ const location = useLocation ( )
6+ const history = useHistory ( )
37
4- const SofiReferralComponent : React . FC < RouteComponentProps > = ( { location } ) => {
58 useEffect ( ( ) => {
69 const searchParams = new URLSearchParams ( location . search )
7- const viewParam = searchParams . get ( 'buy' )
8- const queryString = viewParam ? `?code=${ viewParam } ` : '?ref=sofi'
10+ const hasAllRequiredJwtParams = [ 'aesCiphertext' , 'aesIV' , 'aesTag' , 'aesKeyCiphertext' ] . every (
11+ ( param ) => searchParams . has ( param )
12+ )
13+
14+ // if jwt is present, check the migration status
15+
16+ // if (hasAllRequiredJwtParams && migrationPending) {
17+ if ( hasAllRequiredJwtParams ) {
18+ history . push ( `/sofi${ location . search } ` )
19+ } else {
20+ const viewParam = searchParams . get ( 'buy' )
21+ const queryString = viewParam ? `?code=${ viewParam } &ref=sofi` : '?ref=sofi'
922
10- window . location . href = `https://blockchainwallet.page.link/buysofi${ queryString } `
11- } , [ location ] )
23+ window . location . href = `https://blockchainwallet.page.link/buysofi${ queryString } `
24+ }
25+ } , [ location , history ] )
1226
1327 return null
1428}
You can’t perform that action at this time.
0 commit comments