|
|
@ -71,13 +71,17 @@ AddTokenScreen.prototype.componentWillMount = function () { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
AddTokenScreen.prototype.toggleToken = function (address, token) { |
|
|
|
AddTokenScreen.prototype.toggleToken = function (address, token) { |
|
|
|
const { selectedTokens, errors } = this.state |
|
|
|
const { selectedTokens = {}, errors } = this.state |
|
|
|
const { [address]: selectedToken } = selectedTokens |
|
|
|
const selectedTokensCopy = { ...selectedTokens } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (address in selectedTokensCopy) { |
|
|
|
|
|
|
|
delete selectedTokensCopy[address] |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
selectedTokensCopy[address] = token |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
selectedTokens: { |
|
|
|
selectedTokens: selectedTokensCopy, |
|
|
|
...selectedTokens, |
|
|
|
|
|
|
|
[address]: selectedToken ? null : token, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
errors: { |
|
|
|
errors: { |
|
|
|
...errors, |
|
|
|
...errors, |
|
|
|
tokenSelector: null, |
|
|
|
tokenSelector: null, |
|
|
|