fix(network-reducer): fix updating the balance and not override

This commit is contained in:
Jonathan Rainville 2019-06-28 13:32:30 -04:00
parent 3bad7c57c8
commit 648452da5f
No known key found for this signature in database
GPG Key ID: 5F4630B759727D9C
1 changed files with 19 additions and 4 deletions

View File

@ -51,15 +51,30 @@ function reducer(state = DEFAULT_STATE, action) {
const balance = fromTokenDecimals(action.value, action.token.decimals);
if (action.address && !addressCompare(action.address, state.address)) {
return {
...state, tokens: {
...state.tokens, [action.token.symbol]: {
...action.token, balances: {...state.tokens[action.token.symbol].balances, [action.address]: balance}
...state,
tokens: {
...state.tokens,
[action.token.symbol]: {
...action.token,
balances: {
...state.tokens[action.token.symbol],
...state.tokens[action.token.symbol].balances,
[action.address]: balance
}
}
}
};
}
return {
...state, tokens: { ...state.tokens, [action.token.symbol]: {...action.token, balance} }
...state,
tokens: {
...state.tokens,
[action.token.symbol]: {
...state.tokens[action.token.symbol],
...action.token,
balance
}
}
};
}
case GET_GAS_PRICE_SUCCEEDED: {