chore: remove /swap/:outputCurrency redirect (#5442)

This commit is contained in:
Vignesh Mohankumar 2022-12-01 08:33:02 -05:00 committed by GitHub
parent ce9f4525a3
commit 416212be3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 24 deletions

@ -40,7 +40,7 @@ import PoolFinder from './PoolFinder'
import RemoveLiquidity from './RemoveLiquidity'
import RemoveLiquidityV3 from './RemoveLiquidity/V3'
import Swap from './Swap'
import { OpenClaimAddressModalAndRedirectToSwap, RedirectPathToSwapOnly, RedirectToSwap } from './Swap/redirects'
import { OpenClaimAddressModalAndRedirectToSwap, RedirectPathToSwapOnly } from './Swap/redirects'
import Tokens from './Tokens'
const TokenDetails = lazy(() => import('./TokenDetails'))
@ -214,7 +214,6 @@ export default function App() {
<Route path="uni/:currencyIdA/:currencyIdB" element={<Manage />} />
<Route path="send" element={<RedirectPathToSwapOnly />} />
<Route path="swap/:outputCurrency" element={<RedirectToSwap />} />
<Route path="swap" element={<Swap />} />
<Route path="pool/v2/find" element={<PoolFinder />} />

@ -1,5 +1,5 @@
import { useEffect } from 'react'
import { Navigate, useLocation, useParams } from 'react-router-dom'
import { Navigate, useLocation } from 'react-router-dom'
import { useAppDispatch } from 'state/hooks'
import { ApplicationModal, setOpenModal } from '../../state/application/reducer'
@ -10,27 +10,6 @@ export function RedirectPathToSwapOnly() {
return <Navigate to={{ ...location, pathname: '/swap' }} replace />
}
// Redirects from the /swap/:outputCurrency path to the /swap?outputCurrency=:outputCurrency format
export function RedirectToSwap() {
const location = useLocation()
const { search } = location
const { outputCurrency } = useParams<{ outputCurrency: string }>()
return (
<Navigate
to={{
...location,
pathname: '/swap',
search:
search && search.length > 1
? `${search}&outputCurrency=${outputCurrency}`
: `?outputCurrency=${outputCurrency}`,
}}
replace
/>
)
}
export function OpenClaimAddressModalAndRedirectToSwap() {
const dispatch = useAppDispatch()
useEffect(() => {