diff --git a/frontend/src/page/SentInvoice.jsx b/frontend/src/page/SentInvoice.jsx index bbe2351..8e8bede 100644 --- a/frontend/src/page/SentInvoice.jsx +++ b/frontend/src/page/SentInvoice.jsx @@ -173,10 +173,10 @@ function SentInvoice() { ); const res = await contract.getSentInvoices(address); - console.log("Raw invoices data:", res); + if (!res || !Array.isArray(res) || res.length === 0) { - console.warn("No invoices found."); + setSentInvoices([]); setLoading(false); return; @@ -198,7 +198,6 @@ function SentInvoice() { const currentUserAddress = address.toLowerCase(); if (currentUserAddress !== from && currentUserAddress !== to) { - console.warn(`Unauthorized access attempt for invoice ${id}`); continue; } @@ -335,7 +334,6 @@ function SentInvoice() { console.error("Decryption error:", error); setError("Failed to fetch invoices. Please try again."); } finally { - console.log(sentInvoices); setLoading(false); } }; @@ -889,11 +887,11 @@ function SentInvoice() {
{drawerState.selectedInvoice.paymentToken?.address ? `${drawerState.selectedInvoice.paymentToken.address.substring( - 0, - 10 - )}......${drawerState.selectedInvoice.paymentToken.address.substring( - 33 - )}` + 0, + 10 + )}......${drawerState.selectedInvoice.paymentToken.address.substring( + 33 + )}` : "Native Currency"}
@@ -979,12 +977,11 @@ function SentInvoice() { {drawerState.selectedInvoice.paymentToken?.symbol === "ETH" ? `${( - parseFloat(drawerState.selectedInvoice.amountDue) + - parseFloat(ethers.formatUnits(fee)) - ).toFixed(6)} ETH` - : `${drawerState.selectedInvoice.amountDue} ${ - drawerState.selectedInvoice.paymentToken?.symbol - } + ${ethers.formatUnits(fee)} ETH`} + parseFloat(drawerState.selectedInvoice.amountDue) + + parseFloat(ethers.formatUnits(fee)) + ).toFixed(6)} ETH` + : `${drawerState.selectedInvoice.amountDue} ${drawerState.selectedInvoice.paymentToken?.symbol + } + ${ethers.formatUnits(fee)} ETH`}