-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sofi-referral): fix redirection
- Loading branch information
1 parent
cba1c42
commit 2adab9e
Showing
1 changed file
with
10 additions
and
7 deletions.
There are no files selected for viewing
17 changes: 10 additions & 7 deletions
17
packages/blockchain-wallet-v4-frontend/src/scenes/Refer/Sofi/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import React from 'react' | ||
import { Redirect, RouteComponentProps } from 'react-router-dom' | ||
import React, { useEffect } from 'react' | ||
import { RouteComponentProps } from 'react-router-dom' | ||
|
||
const SofiReferralComponent: React.FC<RouteComponentProps> = ({ location }) => { | ||
const searchParams = new URLSearchParams(location.search) | ||
const viewParam = searchParams.get('buy') | ||
const queryString = viewParam ? `?code=${viewParam}` : '?ref=sofi' | ||
const redirectTo = `https://blockchainwallet.page.link/buysofi${queryString}` | ||
useEffect(() => { | ||
const searchParams = new URLSearchParams(location.search) | ||
const viewParam = searchParams.get('buy') | ||
const queryString = viewParam ? `?code=${viewParam}` : '?ref=sofi' | ||
|
||
return <Redirect to={redirectTo} /> | ||
window.location.href = `https://blockchainwallet.page.link/buysofi${queryString}` | ||
}, [location]) | ||
|
||
return null | ||
} | ||
|
||
export default SofiReferralComponent |