diff options
author | Dan <danjm.com@gmail.com> | 2018-06-19 23:53:33 +0800 |
---|---|---|
committer | Dan <danjm.com@gmail.com> | 2018-06-19 23:53:33 +0800 |
commit | 957d729c17fcf49881d5e403afb9bfc9d0fd852a (patch) | |
tree | b965c67d2fb20f5fc1a06155182f38d91a8c90d8 /ui/app/actions.js | |
parent | 6bf09c0ffe39196ed97405001ee9a094d69a0da2 (diff) | |
download | tangerine-wallet-browser-957d729c17fcf49881d5e403afb9bfc9d0fd852a.tar.gz tangerine-wallet-browser-957d729c17fcf49881d5e403afb9bfc9d0fd852a.tar.zst tangerine-wallet-browser-957d729c17fcf49881d5e403afb9bfc9d0fd852a.zip |
Only show the customize gas modal if the estimateGas call is not currently in flight.
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r-- | ui/app/actions.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 1edf692b6..41fc3c504 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -175,6 +175,8 @@ var actions = { CLEAR_SEND: 'CLEAR_SEND', OPEN_FROM_DROPDOWN: 'OPEN_FROM_DROPDOWN', CLOSE_FROM_DROPDOWN: 'CLOSE_FROM_DROPDOWN', + GAS_LOADING_STARTED: 'GAS_LOADING_STARTED', + GAS_LOADING_FINISHED: 'GAS_LOADING_FINISHED', setGasLimit, setGasPrice, updateGasData, @@ -190,6 +192,8 @@ var actions = { updateSendErrors, clearSend, setSelectedAddress, + gasLoadingStarted, + gasLoadingFinished, // app messages confirmSeedWords: confirmSeedWords, showAccountDetail: showAccountDetail, @@ -740,8 +744,9 @@ function updateGasData ({ to, value, }) { - const estimatedGasPrice = estimateGasPriceFromRecentBlocks(recentBlocks) return (dispatch) => { + dispatch(actions.gasLoadingStarted()) + const estimatedGasPrice = estimateGasPriceFromRecentBlocks(recentBlocks) return Promise.all([ Promise.resolve(estimatedGasPrice), estimateGas({ @@ -762,14 +767,28 @@ function updateGasData ({ .then((gasEstimate) => { dispatch(actions.setGasTotal(gasEstimate)) dispatch(updateSendErrors({ gasLoadingError: null })) + dispatch(actions.gasLoadingFinished()) }) .catch(err => { log.error(err) dispatch(updateSendErrors({ gasLoadingError: 'gasLoadingError' })) + dispatch(actions.gasLoadingFinished()) }) } } +function gasLoadingStarted () { + return { + type: actions.GAS_LOADING_STARTED, + } +} + +function gasLoadingFinished () { + return { + type: actions.GAS_LOADING_FINISHED, + } +} + function updateSendTokenBalance ({ selectedToken, tokenContract, |