diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2016-11-16 09:12:13 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2016-11-16 09:12:13 +0800 |
commit | 5bfb700fa833a415a541a959736d6184d3c07753 (patch) | |
tree | 7839d889016500fc4915c55090faad44e3a2d9ca /ui/app/actions.js | |
parent | e18109f1eac855a828dc5c6011bbc8a4dbc69f4c (diff) | |
download | tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar.gz tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar.bz2 tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar.lz tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar.xz tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.tar.zst tangerine-wallet-browser-5bfb700fa833a415a541a959736d6184d3c07753.zip |
Minimize dispatches by using emitters and relying on state updates.
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r-- | ui/app/actions.js | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 7021c69db..12ba8fffa 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -161,12 +161,11 @@ function tryUnlockMetamask (password) { return (dispatch) => { dispatch(actions.showLoadingIndication()) dispatch(actions.unlockInProgress()) - background.submitPassword(password, (err, newState) => { + background.submitPassword(password, (err) => { dispatch(actions.hideLoadingIndication()) if (err) { dispatch(actions.unlockFailed(err.message)) } else { - dispatch(this.updateMetamaskState(newState)) let selectedAccount try { selectedAccount = newState.metamask.selectedAccount @@ -195,23 +194,19 @@ function confirmSeedWords () { function createNewVaultAndRestore (password, seed) { return (dispatch) => { dispatch(actions.showLoadingIndication()) - background.createNewVaultAndRestore(password, seed, (err, newState) => { + background.createNewVaultAndRestore(password, seed, (err) => { dispatch(actions.hideLoadingIndication()) if (err) return dispatch(actions.displayWarning(err.message)) - dispatch(this.updateMetamaskState(newState)) }) } } function createNewVaultAndKeychain (password, entropy) { return (dispatch) => { - background.createNewVaultAndKeychain(password, entropy, (err, newState) => { + background.createNewVaultAndKeychain(password, entropy, (err) => { if (err) { return dispatch(actions.showWarning(err.message)) } - - dispatch(this.updateMetamaskState(newState)) - dispatch(this.showNewVaultSeed()) }) } } @@ -225,11 +220,10 @@ function revealSeedConfirmation () { function requestRevealSeed (password) { return (dispatch) => { dispatch(actions.showLoadingIndication()) - background.submitPassword(password, (err, newState) => { + background.submitPassword(password, (err) => { dispatch(actions.hideLoadingIndication()) if (err) return dispatch(actions.displayWarning(err.message)) background.placeSeedWords() - dispatch(actions.showNewVaultSeed()) }) } } @@ -238,13 +232,11 @@ function requestRevealSeed (password) { function addNewKeyring (type, opts) { return (dispatch) => { dispatch(actions.showLoadingIndication()) - background.addNewKeyring(type, opts, (err, newState) => { + background.addNewKeyring(type, opts, (err) => { dispatch(this.hideLoadingIndication()) if (err) { return dispatch(actions.showWarning(err)) } - dispatch(this.updateMetamaskState(newState)) - dispatch(this.showAccountsPage()) }) } } @@ -252,12 +244,11 @@ function addNewKeyring (type, opts) { function addNewAccount (ringNumber = 0) { return (dispatch) => { dispatch(actions.showLoadingIndication()) - background.addNewAccount(ringNumber, (err, newState) => { + background.addNewAccount(ringNumber, (err) => { dispatch(this.hideLoadingIndication()) if (err) { return dispatch(actions.showWarning(err)) } - dispatch(this.updateMetamaskState(newState)) }) } } @@ -457,10 +448,6 @@ function lockMetamask () { if (err) { return dispatch(actions.displayWarning(err.message)) } - - dispatch({ - type: actions.LOCK_METAMASK, - }) }) } } |