1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Add confirmation for network dropdown delete action (#9763)

This commit is contained in:
Erik Marks 2020-10-30 12:22:21 -07:00 committed by GitHub
parent ca7df8de0f
commit 1a164cd3e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,9 +42,6 @@ function mapDispatchToProps (dispatch) {
setRpcTarget: (target, chainId, ticker, nickname) => {
dispatch(actions.setRpcTarget(target, chainId, ticker, nickname))
},
delRpcTarget: (target) => {
dispatch(actions.delRpcTarget(target))
},
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
setNetworksTabAddMode: (isInAddMode) => {
dispatch(actions.setNetworksTabAddMode(isInAddMode))
@ -55,6 +52,13 @@ function mapDispatchToProps (dispatch) {
displayInvalidCustomNetworkAlert: (networkName) => {
dispatch(displayInvalidCustomNetworkAlert(networkName))
},
showConfirmDeleteNetworkModal: ({ target, onConfirm }) => {
return dispatch(actions.showModal({
name: 'CONFIRM_DELETE_NETWORK',
target,
onConfirm,
}))
},
}
}
@ -79,8 +83,8 @@ class NetworkDropdown extends Component {
frequentRpcListDetail: PropTypes.array.isRequired,
networkDropdownOpen: PropTypes.bool.isRequired,
history: PropTypes.object.isRequired,
delRpcTarget: PropTypes.func.isRequired,
displayInvalidCustomNetworkAlert: PropTypes.func.isRequired,
showConfirmDeleteNetworkModal: PropTypes.func.isRequired,
}
handleClick (newProviderType) {
@ -151,7 +155,10 @@ class NetworkDropdown extends Component {
className="fa fa-times delete"
onClick={(e) => {
e.stopPropagation()
this.props.delRpcTarget(rpcUrl)
this.props.showConfirmDeleteNetworkModal({
target: rpcUrl,
onConfirm: () => undefined,
})
}}
/>
)