Closed mgarf closed 8 years ago
Currently trying to return a promise all to a composeWithPromise.
Here is what my promise.All Function looks like:
const promiseRemotingCall = Promise.all( [permissionSet, retrieveReceipt, retrieveAccounts, retrieveBillingStatements, retrievePendingWriteOffs, retrieveTemporaryReceiptAllocationsByReceiptId] ) .then(function(results) { console.log(result); result[1].amountAllocated = 0; var clientLength = result[2].length; for (var i = 0; i < clientLength; i++) { if (typeof result[5][result[2][i].Id] != 'undefined') { result[2][i].currentAllocation = result[5][result[2][i].Id]; } else { result[2][i].currentAllocation = 0; } result[2][i].outstandingBalance = 0; result[2][i].previousBalance = 0; } var billingStatementLength = result[3].length; for (var i = 0; i < billingStatementLength; i++) { if (typeof result[5][result[3][i].Id] != 'undefined') { result[3][i].amountAllocated = result[5][result[3][i].Id]; } else { result[3][i].amountAllocated = 0; } result[3][i].inputValue = result[3][i].amountAllocated; if (typeof result[4][result[3][i].Id] != 'undefined') { result[3][i].c2g__OutstandingValue__c = result[3][i].c2g__OutstandingValue__c - result[4][result[3][i].Id][result[3][i].Id]; result[3][i].writeOffAmount = result[4][result[3][i].Id][result[3][i].Id]; } } result.push('{!$Resource.SLDS}'); console.log(result); return result; }) .catch(function(error) { return error; });
And what my compose looks like:
const onPropsChange = function(props) { const returnedCall = promiseRemotingCall; console.log(returnedCall); return returnedCall; }; const CashAllocationUIContainer = composeWithPromise(onPropsChange)(CashAllocation); export default CashAllocationUIContainer;
I've also tried:
const onPropsChange = function(props) { return new Promise((resolve) => { const returnedCall = promiseRemotingCall; console.log(returnedCall); resolve(returnedCall); }); };
Any thoughts on what I can do to fix this?
Currently trying to return a promise all to a composeWithPromise.
Here is what my promise.All Function looks like:
And what my compose looks like:
I've also tried:
Any thoughts on what I can do to fix this?