mirror of
https://github.com/trezor/trezor-wallet
synced 2025-01-23 14:31:07 +00:00
Disallow adding tokens that are already added
This commit is contained in:
parent
a848e35b69
commit
5e42466f99
@ -131,7 +131,12 @@ const AccountSummary = (props: Props) => {
|
|||||||
placeholder="Search for the token"
|
placeholder="Search for the token"
|
||||||
loadingMessage={() => 'Loading...'}
|
loadingMessage={() => 'Loading...'}
|
||||||
noOptionsMessage={() => 'Token not found'}
|
noOptionsMessage={() => 'Token not found'}
|
||||||
onChange={token => props.addToken(token, account)}
|
onChange={(token) => {
|
||||||
|
const isAdded = tokens.find(t => t.symbol === token.symbol);
|
||||||
|
if (!isAdded) {
|
||||||
|
props.addToken(token, account);
|
||||||
|
}
|
||||||
|
}}
|
||||||
loadOptions={input => props.loadTokens(input, account.network)}
|
loadOptions={input => props.loadTokens(input, account.network)}
|
||||||
formatOptionLabel={(option) => {
|
formatOptionLabel={(option) => {
|
||||||
const isAdded = tokens.find(t => t.symbol === option.symbol);
|
const isAdded = tokens.find(t => t.symbol === option.symbol);
|
||||||
|
Loading…
Reference in New Issue
Block a user