error color

pull/5370/head
Aniket-Engg 2 years ago committed by Aniket
parent 81d2c4d408
commit 17bb30a38c
  1. 20
      apps/etherscan/src/app/views/ReceiptsView.tsx

@ -12,7 +12,7 @@ interface FormValues {
}
export const ReceiptsView: React.FC = () => {
const [results, setResults] = useState("")
const [results, setResults] = useState({succeed: false, message: ''})
const onGetReceiptStatus = async (
values: FormValues,
clientInstance: any,
@ -21,7 +21,10 @@ export const ReceiptsView: React.FC = () => {
try {
const network = await getNetworkName(clientInstance)
if (network === "vm") {
setResults("Cannot verify in the selected network")
setResults({
succeed: false,
message: "Cannot verify in the selected network"
})
return
}
const etherscanApi = getEtherScanApi(network)
@ -30,9 +33,15 @@ export const ReceiptsView: React.FC = () => {
apiKey,
etherscanApi
)
setResults(result.result)
setResults({
succeed: result.status === '1' ? true : false,
message: result.result
})
} catch (error: any) {
setResults(error.message)
setResults({
succeed: false,
message: error.message
})
}
}
@ -93,8 +102,9 @@ export const ReceiptsView: React.FC = () => {
marginTop: "2em",
fontSize: "0.8em",
textAlign: "center",
color: results['succeed'] ? "green" : "red"
}}
dangerouslySetInnerHTML={{ __html: results }}
dangerouslySetInnerHTML={{ __html: results.message ? results.message : '' }}
/>
<ReceiptsTable receipts={receipts} />

Loading…
Cancel
Save