I have a promise chain like the one below, that has three promises in it. I've been studying Rx.js for a bit now, and I can't figure out where to start when it comes to converting these promises to observables and chaining this information around into the different functions. I'd really appreciate some guidance / knowledge if it's even possible.
export function pushCustomers (mongo, shopify) {
return getDocsWhereRequest(mongo, 'shopify_customers').map(customer => {
return createCustomer (shopify, customer.shopifyRequest).then(shopifyResponse => {
return updateCollection(mongo, 'shopify_customers', {email: customer.email}, {shopifyResponse})
}).catch(err => {
if (!_.get(err, 'response.body.errors')) throw err
let shopifyResponseError = JSON.stringify(err.response.body.errors)
return updateCollection(mongo, 'shopify_customers', {email: customer.email}, {shopifyResponseError})
})
})
}