diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-01-04 02:42:09 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-01-04 02:42:09 +0800 |
commit | 8b7b097034f274631917b2df8617c24feb09f69c (patch) | |
tree | a43a557485d2a20bb1e12f504a20f98c68e483d5 | |
parent | 3ebf029c04b15599f571a19524474df9680efa7d (diff) | |
download | tangerine-wallet-browser-8b7b097034f274631917b2df8617c24feb09f69c.tar tangerine-wallet-browser-8b7b097034f274631917b2df8617c24feb09f69c.tar.gz tangerine-wallet-browser-8b7b097034f274631917b2df8617c24feb09f69c.tar.bz2 tangerine-wallet-browser-8b7b097034f274631917b2df8617c24feb09f69c.tar.lz tangerine-wallet-browser-8b7b097034f274631917b2df8617c24feb09f69c.tar.xz tangerine-wallet-browser-8b7b097034f274631917b2df8617c24feb09f69c.tar.zst tangerine-wallet-browser-8b7b097034f274631917b2df8617c24feb09f69c.zip |
Apply new pattern to repetitive functions
-rw-r--r-- | ui/app/actions.js | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 018baff73..bc9b4a092 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -231,7 +231,6 @@ function createNewVaultAndKeychain (password) { if (err) { return dispatch(actions.showWarning(err.message)) } - dispatch(actions.updateMetamaskState(newState)) }) } } @@ -467,16 +466,7 @@ function updateMetamaskState (newState) { } function lockMetamask () { - return (dispatch) => { - dispatch(actions.showLoadingIndication()) - background.setLocked((err, newState) => { - dispatch(actions.hideLoadingIndication()) - if (err) { - return dispatch(actions.displayWarning(err.message)) - } - dispatch(actions.updateMetamaskState(newState)) - }) - } + return callBackgroundThenUpdate(background.setLocked) } function showAccountDetail (address) { @@ -586,14 +576,7 @@ function clearNotices () { } function markAccountsFound() { - return (dispatch) => { - dispatch(this.showLoadingIndication()) - background.markAccountsFound((err, newState) => { - dispatch(this.hideLoadingIndication()) - if (err) return dispatch(this.showWarning(err.message)) - dispatch(actions.updateMetamaskState(newState)) - }) - } + return callBackgroundThenUpdate(background.markAccountsFound) } // |