Created
July 27, 2018 00:22
-
-
Save Pyrolistical/33c3cf1c22e232c7080d8a6948341c65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const doABRegister = function( connectAPI, { appGuid, serialNumber, email }, data, logger ) { | |
const deviceIdPromise = doABRegisterDevice( connectAPI, appGuid, serialNumber ); | |
const accountIdPromise = deviceIdPromise | |
.then( deviceId => doABCreateAccount( connectAPI, appGuid, deviceId, email, data ); | |
const vhIdPromise = Promise.all([deviceIdPromise, accountIdPromise]) | |
.then( ([deviceId, accountId]) => doABFetchVh( connectAPI, { appGuid, deviceId, accountId }, data, logger ); | |
return Promise.all([deviceIdPromise, accountIdPromise, vhIdPromise]) | |
.then( ([deviceId, accountId, vhId]) => ( { deviceId, accountId, vhId } ); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment