【发布时间】:2018-11-22 07:46:30
【问题描述】:
如何重写此代码以使其不嵌套?我还需要访问之前函数调用中获得的值。
return docRef2.doc(`/users_stripe/${context.params.userID}`).get()
.then(snapshot => {
console.log("augu", snapshot);
return stripe.customers.createSource( jsonParser(snapshot._fieldsProto.id, "stringValue"),
{ source: jsonParser(snap._fieldsProto.token, "stringValue") },
function(err, card) {
console.log("listen people", card);
return docRef2.doc(`/users_stripe/${context.params.userID}/ptypes/ptypes`)
.set(card);
});
})
【问题讨论】:
标签: javascript node.js promise google-cloud-functions