do not calc date if no fundProfile

This commit is contained in:
Barry Gitarts 2018-12-12 15:46:02 -05:00
parent a2143d5b84
commit 6b76e98e78
2 changed files with 22 additions and 21 deletions

View File

@ -16,7 +16,7 @@ const convertToDatetime = (field, fundProfiles) => {
const { commitTime, id } = field
const profile = fundProfiles[id - 1]
//TODO fix - add commitTime from funder and delegates to get actual dateTime
if (Number(commitTime) === 0) return 0
if (!profile || Number(commitTime) === 0) return 0
const time = Number(commitTime) + Number(profile.commitTime)
const date = new Date(time * 1000)
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`

View File

@ -17,26 +17,27 @@ const { transfer } = LiquidPledgingMock.methods
const TransferDialog = ({ row, handleClose, transferPledgeAmounts }) => (
<Formik
initialValues={{}}
onSubmit={async (values, { setSubmitting, resetForm, setStatus }) => {
const { id } = row
const { idSender, amount, idReceiver } = values
const args = [idSender, id, toWei(amount.toString()), idReceiver]
const toSend = transfer(...args);
const estimatedGas = await toSend.estimateGas();
toSend.send({gas: estimatedGas + 1000})
.then(res => {
console.log({res})
const { events: { Transfer: { returnValues } } } = res
transferPledgeAmounts(returnValues)
handleClose()
})
.catch(e => {
console.log({e})
})
.finally(() => { resetForm() })
}}
onSubmit={async (values, { setSubmitting, resetForm, setStatus }) => {
const { id } = row
const { idSender, amount, idReceiver } = values
const args = [idSender, id, toWei(amount.toString()), idReceiver]
const toSend = transfer(...args);
const estimatedGas = await toSend.estimateGas();
toSend.send({gas: estimatedGas + 1000})
.then(res => {
console.log({res})
const { events: { Transfer: { returnValues } } } = res
transferPledgeAmounts(returnValues)
})
.catch(e => {
console.log({e})
})
.finally(() => {
handleClose()
resetForm()
})
}}
>
{({
values,