aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2019-03-29 12:40:04 +0800
committerkumavis <aaron@kumavis.me>2019-03-29 12:40:04 +0800
commitedec6cb81d24dbe07aba53c772ff762da92399d1 (patch)
treee536245d2a63e8602af07129b25782c404b81be6
parent846038a69c4cde10417ce54b280de3624d87d45c (diff)
downloadtangerine-wallet-browser-edec6cb81d24dbe07aba53c772ff762da92399d1.tar
tangerine-wallet-browser-edec6cb81d24dbe07aba53c772ff762da92399d1.tar.gz
tangerine-wallet-browser-edec6cb81d24dbe07aba53c772ff762da92399d1.tar.bz2
tangerine-wallet-browser-edec6cb81d24dbe07aba53c772ff762da92399d1.tar.lz
tangerine-wallet-browser-edec6cb81d24dbe07aba53c772ff762da92399d1.tar.xz
tangerine-wallet-browser-edec6cb81d24dbe07aba53c772ff762da92399d1.tar.zst
tangerine-wallet-browser-edec6cb81d24dbe07aba53c772ff762da92399d1.zip
actions - setCompletedOnboarding - make async with pify
-rw-r--r--ui/app/store/actions.js41
1 files changed, 17 insertions, 24 deletions
diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js
index 785cadc3c..db3427ee6 100644
--- a/ui/app/store/actions.js
+++ b/ui/app/store/actions.js
@@ -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())
}
}