fix encoding errors

filter out undefined pledges
This commit is contained in:
Barry Gitarts 2019-05-23 18:25:04 -04:00 committed by Barry G
parent 26f7c2bda6
commit c0423b10e0
1 changed files with 4 additions and 4 deletions

View File

@ -169,11 +169,11 @@ const getSendFn = (pledgeType, filteredPledges) => {
const getArgs = (pledgeType, filteredPledges) => {
if (pledgeTypes[pledgeType] === PLEDGED) {
const formattedPledges = filteredPledges.map(pledge => ({ amount: pledge.amount, id: pledge.idPledge }))
const encodedPledges = encodePledges(formattedPledges)
const withdrawArgs = [filteredPledges[0].id, filteredPledges[0].amount]
return filteredPledges.length > 1 ? [encodedPledges] : withdrawArgs
if (filteredPledges.length > 1) return [encodePledges(formattedPledges)]
const withdrawArgs = [formattedPledges[0].id, formattedPledges[0].amount]
return withdrawArgs
}
const { idPayment } = filteredPledges[0].authorization.returnValues
const { idPayment } = filteredPledges.filter(p => !!p)[0].authorization.returnValues
return [idPayment]
}
const SubmissionSection = ({ classes, openSnackBar, syncWithRemote, pledges, pledgeType }) => {