Fix error handling
This commit is contained in:
parent
62df32b82f
commit
0c7cc1fc64
@ -36,6 +36,7 @@ const AddressTransactions: React.FC = () => {
|
||||
|
||||
const [checksummedAddress, setChecksummedAddress] = useState<string>();
|
||||
const [isENS, setENS] = useState<boolean>();
|
||||
const [error, setError] = useState<boolean>();
|
||||
|
||||
// If it looks like it is an ENS name, try to resolve it
|
||||
useEffect(() => {
|
||||
@ -50,6 +51,9 @@ const AddressTransactions: React.FC = () => {
|
||||
if (resolvedAddress !== null) {
|
||||
setENS(true);
|
||||
setChecksummedAddress(resolvedAddress);
|
||||
setError(false);
|
||||
} else {
|
||||
setError(true);
|
||||
}
|
||||
};
|
||||
resolveName();
|
||||
@ -129,12 +133,15 @@ const AddressTransactions: React.FC = () => {
|
||||
|
||||
const [feeDisplay, feeDisplayToggler] = useFeeToggler();
|
||||
|
||||
if (!checksummedAddress) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
return (
|
||||
<StandardFrame>
|
||||
{error ? (
|
||||
<span className="text-base">
|
||||
"{params.addressOrName}" is not an ETH address or ENS name.
|
||||
</span>
|
||||
) : (
|
||||
checksummedAddress && (
|
||||
<>
|
||||
<StandardSubtitle>
|
||||
<div className="flex space-x-2 items-baseline">
|
||||
<Blockies
|
||||
@ -182,7 +189,7 @@ const AddressTransactions: React.FC = () => {
|
||||
<TransactionItem
|
||||
key={tx.hash}
|
||||
tx={tx}
|
||||
selectedAddress={params.addressOrName}
|
||||
selectedAddress={checksummedAddress}
|
||||
feeDisplay={feeDisplay}
|
||||
/>
|
||||
))}
|
||||
@ -205,6 +212,9 @@ const AddressTransactions: React.FC = () => {
|
||||
<PendingResults />
|
||||
)}
|
||||
</ContentFrame>
|
||||
</>
|
||||
)
|
||||
)}
|
||||
</StandardFrame>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user