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

View File

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