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 1
1
import 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 ( )
3
7
4
- const SofiReferralComponent : React . FC < RouteComponentProps > = ( { location } ) => {
5
8
useEffect ( ( ) => {
6
9
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'
9
22
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 ] )
12
26
13
27
return null
14
28
}
You can’t perform that action at this time.
0 commit comments