diff --git a/frontend/src/components/Beneficiary.jsx b/frontend/src/components/Beneficiary.jsx index e77dbbf..82fdc97 100755 --- a/frontend/src/components/Beneficiary.jsx +++ b/frontend/src/components/Beneficiary.jsx @@ -38,16 +38,29 @@ function Beneficiary() { var will_beneficiary = await eth.contractWithSigner.wills(response[i].toNumber()); //console.log(response[i].toNumber()); - var withdrawdateNew = timeConverter(will_beneficiary.withdrawDate.toNumber()); - - var myWill = { - id: response[i].toNumber(), - amount: ethers.utils.formatEther(will_beneficiary.amount), - testator: will_beneficiary.testator, - beneficiary: will_beneficiary.beneficiary, - withdrawDate: withdrawdateNew + try{ + var withdrawdateNew = timeConverter(will_beneficiary.withdrawDate.toNumber()); + var myWill = { + id: response[i].toNumber(), + amount: ethers.utils.formatEther(will_beneficiary.amount), + testator: will_beneficiary.testator, + beneficiary: will_beneficiary.beneficiary, + withdrawDate: withdrawdateNew + } } - console.log(myWill) + catch(e) { + console.log("Invalid withdrawDate"); + var myWill = { + id: response[i].toNumber(), + amount: ethers.utils.formatEther(will_beneficiary.amount), + testator: will_beneficiary.testator, + beneficiary: will_beneficiary.beneficiary, + withdrawDate: "Invalid withdrawDate: " + will_beneficiary.withdrawDate._hex + } + + } + + console.log(myWill) myBeneficiary.push(myWill); } setwill_beneficiary(myBeneficiary); diff --git a/frontend/src/components/CardBeneficiary.jsx b/frontend/src/components/CardBeneficiary.jsx index 3d23da9..2261cd8 100755 --- a/frontend/src/components/CardBeneficiary.jsx +++ b/frontend/src/components/CardBeneficiary.jsx @@ -42,10 +42,13 @@ async function withdraw(){
{ props.amount > 0 ? +
+
: } +
) diff --git a/frontend/src/components/Testator.jsx b/frontend/src/components/Testator.jsx index 5eb6dd2..84816b6 100755 --- a/frontend/src/components/Testator.jsx +++ b/frontend/src/components/Testator.jsx @@ -34,14 +34,25 @@ function Testator() { console.log(response[i].toNumber()); var will_testator = await eth.contractWithSigner.wills(response[i].toNumber()); - var withdrawdateNew = timeConverter(will_testator.withdrawDate.toNumber()); - - var myWill = { - id: response[i].toNumber(), - amount: ethers.utils.formatEther(will_testator.amount), - testator: will_testator.testator, - beneficiary: will_testator.beneficiary, - withdrawDate: withdrawdateNew + try{ + var withdrawdateNew = timeConverter(will_testator.withdrawDate.toNumber()); + var myWill = { + id: response[i].toNumber(), + amount: ethers.utils.formatEther(will_testator.amount), + testator: will_testator.testator, + beneficiary: will_testator.beneficiary, + withdrawDate: withdrawdateNew + } + } + catch(e) { + console.log("Invalid withdrawDate"); + var myWill = { + id: response[i].toNumber(), + amount: ethers.utils.formatEther(will_testator.amount), + testator: will_testator.testator, + beneficiary: will_testator.beneficiary, + withdrawDate: "Invalid withdrawDate: " + will_testator.withdrawDate._hex, + } } myWills.push(myWill); }