From e44f2cc185f7c69a5486dfe67a781bcccdf2f614 Mon Sep 17 00:00:00 2001 From: Perkio0o <7medouu@gmail.com> Date: Thu, 7 Sep 2023 10:05:59 +0800 Subject: [PATCH] Update Minter.js balance here is still a promise, handle that promise and then pass it to react for rendering --- client/src/Minter.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/Minter.js b/client/src/Minter.js index a7d404f..c18d4d2 100644 --- a/client/src/Minter.js +++ b/client/src/Minter.js @@ -48,8 +48,11 @@ const Minter = (props) => { setWallet(accounts[0]); setStatus("👆🏽 Write a message in the text-field above."); // Fetch and update the account balance - const balance = getAccountBalance(accounts[0]); - setBalance(balance); + getAccountBalance(accounts[0]).then((balance)=>{ + setBalance(balance)}) + .catch((error)=>{ + console.error(error) + }) } else { setWallet(""); @@ -187,4 +190,4 @@ const Minter = (props) => { ); }; -export default Minter; \ No newline at end of file +export default Minter;