actions - setCompletedOnboarding - make async with pify

feature/default_network_editable
kumavis 6 years ago
parent 846038a69c
commit edec6cb81d
  1. 41
      ui/app/store/actions.js

@ -2488,34 +2488,27 @@ function setShowFiatConversionOnTestnetsPreference (value) {
} }
function setCompletedOnboarding () { function setCompletedOnboarding () {
return dispatch => { return async dispatch => {
dispatch(actions.showLoadingIndication()) dispatch(actions.showLoadingIndication())
return new Promise((resolve, reject) => {
background.markAllNoticesRead(err => {
if (err) { try {
dispatch(actions.displayWarning(err.message)) await pify(background.markAllNoticesRead).call(background)
return reject(err) } catch (err) {
} dispatch(actions.displayWarning(err.message))
throw err
}
dispatch(actions.clearNotices()) dispatch(actions.clearNotices())
resolve(false)
})
})
.then(() => {
return new Promise((resolve, reject) => {
background.completeOnboarding(err => {
if (err) {
dispatch(actions.displayWarning(err.message))
return reject(err)
}
dispatch(actions.completeOnboarding()) try {
dispatch(actions.hideLoadingIndication()) await pify(background.completeOnboarding).call(background)
resolve() } catch (err) {
}) dispatch(actions.displayWarning(err.message))
}) throw err
}) }
dispatch(actions.completeOnboarding())
dispatch(actions.hideLoadingIndication())
} }
} }

Loading…
Cancel
Save