Skip to content

Commit

Permalink
feat: remove connected react router (#627)
Browse files Browse the repository at this point in the history
BREAKING CHANGE : location saga was moved to a hook "useManaFiatGatewayPurchase"
  • Loading branch information
Melisa Anabella Rossi authored Jun 11, 2024
1 parent 2ae6c54 commit 73d0313
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 291 deletions.
43 changes: 0 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"@types/redux-storage-engine-localstorage": "^1.1.1",
"@types/uuid": "^9.0.5",
"@types/ws": "^8.5.3",
"connected-react-router": "^6.9.1",
"dcl-tslint-config-standard": "^1.0.1",
"history": "^4.10.1",
"husky": "^0.14.3",
Expand Down Expand Up @@ -90,7 +89,6 @@
"validate-commit-message": "^3.0.1"
},
"peerDependencies": {
"connected-react-router": "^6.9.1",
"history": "^4.10.1",
"react": "^17.0.2",
"react-redux": "^7.2.4",
Expand Down
37 changes: 37 additions & 0 deletions src/hooks/useManaFiatGatewayPurchase.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Network } from '@dcl/schemas'
import { NetworkGatewayType } from 'decentraland-ui'
import { useHistory, useLocation } from 'react-router'
import { MoonPayTransactionStatus } from '../modules/gateway/moonpay/types'
import { useDispatch } from 'react-redux'
import { manaFiatGatewayPurchaseCompleted } from '../modules/gateway'

export default function useManaFiatGatewayPurchase() {
const location = useLocation()
const query = new URLSearchParams(location.search)
const network = query.get('network') as Network
const gateway = query.get('gateway') as NetworkGatewayType
const transactionId = query.get('transactionId') as string
const transactionStatus = query.get(
'transactionStatus'
) as MoonPayTransactionStatus
const history = useHistory()
const dispatch = useDispatch()

if (transactionId && transactionStatus && network && gateway) {
const queryParams = new URLSearchParams(query)
const params = ['transactionId', 'transactionStatus', 'network', 'gateway']

params.forEach(param => queryParams.delete(param))

history.replace(`${location.pathname}?${queryParams.toString()}`)

dispatch(
manaFiatGatewayPurchaseCompleted(
network,
gateway,
transactionId,
transactionStatus
)
)
}
}
2 changes: 0 additions & 2 deletions src/modules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as features from './features'
import * as gateway from './gateway'
import * as identity from './identity'
import * as loading from './loading'
import * as location from './location'
import * as modal from './modal'
import * as profile from './profile'
import * as toast from './toast'
Expand All @@ -19,7 +18,6 @@ export {
gateway,
identity,
loading,
location,
modal,
profile,
toast,
Expand Down
2 changes: 0 additions & 2 deletions src/modules/location/index.ts

This file was deleted.

191 changes: 0 additions & 191 deletions src/modules/location/sagas.spec.ts

This file was deleted.

41 changes: 0 additions & 41 deletions src/modules/location/sagas.ts

This file was deleted.

Loading

0 comments on commit 73d0313

Please sign in to comment.