1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Apply new pattern to repetitive functions

This commit is contained in:
Dan Finlay 2017-01-03 10:42:09 -08:00
parent 3ebf029c04
commit 8b7b097034

View File

@ -231,7 +231,6 @@ function createNewVaultAndKeychain (password) {
if (err) { if (err) {
return dispatch(actions.showWarning(err.message)) return dispatch(actions.showWarning(err.message))
} }
dispatch(actions.updateMetamaskState(newState))
}) })
} }
} }
@ -467,16 +466,7 @@ function updateMetamaskState (newState) {
} }
function lockMetamask () { function lockMetamask () {
return (dispatch) => { return callBackgroundThenUpdate(background.setLocked)
dispatch(actions.showLoadingIndication())
background.setLocked((err, newState) => {
dispatch(actions.hideLoadingIndication())
if (err) {
return dispatch(actions.displayWarning(err.message))
}
dispatch(actions.updateMetamaskState(newState))
})
}
} }
function showAccountDetail (address) { function showAccountDetail (address) {
@ -586,14 +576,7 @@ function clearNotices () {
} }
function markAccountsFound() { function markAccountsFound() {
return (dispatch) => { return callBackgroundThenUpdate(background.markAccountsFound)
dispatch(this.showLoadingIndication())
background.markAccountsFound((err, newState) => {
dispatch(this.hideLoadingIndication())
if (err) return dispatch(this.showWarning(err.message))
dispatch(actions.updateMetamaskState(newState))
})
}
} }
// //