mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
actions - setCompletedOnboarding - make async with pify
This commit is contained in:
parent
846038a69c
commit
edec6cb81d
@ -2488,34 +2488,27 @@ function setShowFiatConversionOnTestnetsPreference (value) {
|
||||
}
|
||||
|
||||
function setCompletedOnboarding () {
|
||||
return dispatch => {
|
||||
return async dispatch => {
|
||||
dispatch(actions.showLoadingIndication())
|
||||
return new Promise((resolve, reject) => {
|
||||
background.markAllNoticesRead(err => {
|
||||
|
||||
try {
|
||||
await pify(background.markAllNoticesRead).call(background)
|
||||
} catch (err) {
|
||||
dispatch(actions.displayWarning(err.message))
|
||||
throw err
|
||||
}
|
||||
|
||||
if (err) {
|
||||
dispatch(actions.displayWarning(err.message))
|
||||
return reject(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)
|
||||
}
|
||||
try {
|
||||
await pify(background.completeOnboarding).call(background)
|
||||
} catch (err) {
|
||||
dispatch(actions.displayWarning(err.message))
|
||||
throw err
|
||||
}
|
||||
|
||||
dispatch(actions.completeOnboarding())
|
||||
dispatch(actions.hideLoadingIndication())
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
})
|
||||
dispatch(actions.completeOnboarding())
|
||||
dispatch(actions.hideLoadingIndication())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user