chore: remove /swap/:outputCurrency redirect (#5442)
This commit is contained in:
parent
ce9f4525a3
commit
416212be3b
@ -40,7 +40,7 @@ import PoolFinder from './PoolFinder'
|
|||||||
import RemoveLiquidity from './RemoveLiquidity'
|
import RemoveLiquidity from './RemoveLiquidity'
|
||||||
import RemoveLiquidityV3 from './RemoveLiquidity/V3'
|
import RemoveLiquidityV3 from './RemoveLiquidity/V3'
|
||||||
import Swap from './Swap'
|
import Swap from './Swap'
|
||||||
import { OpenClaimAddressModalAndRedirectToSwap, RedirectPathToSwapOnly, RedirectToSwap } from './Swap/redirects'
|
import { OpenClaimAddressModalAndRedirectToSwap, RedirectPathToSwapOnly } from './Swap/redirects'
|
||||||
import Tokens from './Tokens'
|
import Tokens from './Tokens'
|
||||||
|
|
||||||
const TokenDetails = lazy(() => import('./TokenDetails'))
|
const TokenDetails = lazy(() => import('./TokenDetails'))
|
||||||
@ -214,7 +214,6 @@ export default function App() {
|
|||||||
<Route path="uni/:currencyIdA/:currencyIdB" element={<Manage />} />
|
<Route path="uni/:currencyIdA/:currencyIdB" element={<Manage />} />
|
||||||
|
|
||||||
<Route path="send" element={<RedirectPathToSwapOnly />} />
|
<Route path="send" element={<RedirectPathToSwapOnly />} />
|
||||||
<Route path="swap/:outputCurrency" element={<RedirectToSwap />} />
|
|
||||||
<Route path="swap" element={<Swap />} />
|
<Route path="swap" element={<Swap />} />
|
||||||
|
|
||||||
<Route path="pool/v2/find" element={<PoolFinder />} />
|
<Route path="pool/v2/find" element={<PoolFinder />} />
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useEffect } from 'react'
|
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 { useAppDispatch } from 'state/hooks'
|
||||||
|
|
||||||
import { ApplicationModal, setOpenModal } from '../../state/application/reducer'
|
import { ApplicationModal, setOpenModal } from '../../state/application/reducer'
|
||||||
@ -10,27 +10,6 @@ export function RedirectPathToSwapOnly() {
|
|||||||
return <Navigate to={{ ...location, pathname: '/swap' }} replace />
|
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() {
|
export function OpenClaimAddressModalAndRedirectToSwap() {
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user