feat(trading): do not show error message if there is no faucet tx error (#5539)

This commit is contained in:
Bartłomiej Głownia 2024-01-02 10:19:10 +01:00 committed by GitHub
parent 7fff33e493
commit ad74b12908
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,9 +17,12 @@ export const useGetFaucetError = (error: TxError | null, symbol?: string) => {
'The faucet transaction was rejected by the connected Ethereum wallet'
),
};
if (!error) {
return error;
}
// render a customized failure message from the map above or fallback
// to a non generic error message
return error && 'reason' in error && reasonMap[error.reason]
return 'reason' in error && reasonMap[error.reason]
? reasonMap[error.reason]
: t('Faucet of {{symbol}} failed', { symbol: symbol || '' });
};