Merge pull request #4028 from MetaMask/i4016-customrpc

Fix custom RPC not redirecting to Settings page
feature/default_network_editable
Dan Finlay 7 years ago committed by GitHub
commit f1c0d8ad6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      ui/app/components/dropdowns/network-dropdown.js

@ -3,12 +3,14 @@ const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('react-redux').connect
const { withRouter } = require('react-router-dom')
const { compose } = require('recompose')
const actions = require('../../actions') const actions = require('../../actions')
const Dropdown = require('./components/dropdown').Dropdown const Dropdown = require('./components/dropdown').Dropdown
const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem
const NetworkDropdownIcon = require('./components/network-dropdown-icon') const NetworkDropdownIcon = require('./components/network-dropdown-icon')
const R = require('ramda') const R = require('ramda')
const { SETTINGS_ROUTE } = require('../../routes')
// classes from nodes of the toggle element. // classes from nodes of the toggle element.
const notToggleElementClassnames = [ const notToggleElementClassnames = [
@ -41,9 +43,6 @@ function mapDispatchToProps (dispatch) {
setRpcTarget: (target) => { setRpcTarget: (target) => {
dispatch(actions.setRpcTarget(target)) dispatch(actions.setRpcTarget(target))
}, },
showConfigPage: () => {
dispatch(actions.showConfigPage())
},
showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()), showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()),
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()), hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
} }
@ -59,7 +58,10 @@ NetworkDropdown.contextTypes = {
t: PropTypes.func, t: PropTypes.func,
} }
module.exports = connect(mapStateToProps, mapDispatchToProps)(NetworkDropdown) module.exports = compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps)
)(NetworkDropdown)
// TODO: specify default props and proptypes // TODO: specify default props and proptypes
@ -227,7 +229,7 @@ NetworkDropdown.prototype.render = function () {
DropdownMenuItem, DropdownMenuItem,
{ {
closeMenu: () => this.props.hideNetworkDropdown(), closeMenu: () => this.props.hideNetworkDropdown(),
onClick: () => this.props.showConfigPage(), onClick: () => this.props.history.push(SETTINGS_ROUTE),
style: dropdownMenuItemStyle, style: dropdownMenuItemStyle,
}, },
[ [

Loading…
Cancel
Save