I'm new to ES6 promises and have two promises that I would like to chain. The issue i'm having is that I would like to pass down the result from the first promise down to the 2nd .then()
statement. here is what I have so far:
export function resolvePage(pageName, contentType) {
return contentful.fetchContentByQuery(contentType, {
'fields.slug': pageName,
})
.then((resOne) => {
return contentful.client.getEntries({
'content_type': 'blogArticle'
})
})
.then((resTwo) => {
console.log(resOne)
console.log(resTwo)
return Promise.reject();
});
}
I can't seem to figure out how to chain these properly so that at the end of the chain I have access to both promise results. Could someone please point me in the right direction and tell me where i'm going wrong? I tried passing resOne as a parameter to the 2nd then statement but still wouldn't work