diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-03-09 01:06:41 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2017-03-09 01:06:41 +0800 |
commit | cf2268c3d29d97afa22cd11663bb6e3e74c09b5a (patch) | |
tree | 1afca345c3276d7edb4ed07309dff8985f71b628 /ui/app/actions.js | |
parent | 4562e41d33dfe81e305c20583983fba528ee1a9d (diff) | |
download | tangerine-wallet-browser-cf2268c3d29d97afa22cd11663bb6e3e74c09b5a.tar tangerine-wallet-browser-cf2268c3d29d97afa22cd11663bb6e3e74c09b5a.tar.gz tangerine-wallet-browser-cf2268c3d29d97afa22cd11663bb6e3e74c09b5a.tar.bz2 tangerine-wallet-browser-cf2268c3d29d97afa22cd11663bb6e3e74c09b5a.tar.lz tangerine-wallet-browser-cf2268c3d29d97afa22cd11663bb6e3e74c09b5a.tar.xz tangerine-wallet-browser-cf2268c3d29d97afa22cd11663bb6e3e74c09b5a.tar.zst tangerine-wallet-browser-cf2268c3d29d97afa22cd11663bb6e3e74c09b5a.zip |
Nodeify and promisify calls to background.
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r-- | ui/app/actions.js | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 2fc0d3523..062a691e2 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -674,21 +674,37 @@ function markAccountsFound() { // default rpc target refers to localhost:8545 in this instance. function setDefaultRpcTarget (rpcList) { log.debug(`background.setDefaultRpcTarget`) - background.setDefaultRpc() - return { - type: actions.SET_RPC_TARGET, - value: 'http://localhost:8545', + return (dispatch) => { + background.setDefaultRpc((err, result) => { + if (err) { + console.error(err) + return dispatch(self.displayWarning('Had a problem changing networks.')) + } + dispatch(self.setRpc(result)) + }) } + } function setRpcTarget (newRpc) { - return (dispatch) => { log.debug(`background.setRpcTarget`) - background.setCustomRpc(newRpc) - return { - type: actions.SET_RPC_TARGET, - value: newRpc, + return (dispatch) => { + background.setCustomRpc(newRpc, (err, result) => { + if (err) { + console.err(err) + return dispatch(self.displayWarning('Had a problem changing networks!')) + } + dispatch(self.setRpc(result)) + }) } + + +} + +function setRpc (newRpc) { + return { + type: actions.SET_RPC_TARGET, + value: 'http://localhost:8545', } } |