Fixing tokens sent as Array (#3621)

This commit is contained in:
Nicolas Gotchac 2016-11-25 17:10:02 +01:00 committed by Jaco Greeff
parent 6d6e942d9d
commit 7610336596

View File

@ -64,6 +64,16 @@ export default handleActions({
setTokens (state, action) {
const { tokens } = action;
if (Array.isArray(tokens)) {
const objTokens = tokens.reduce((_tokens, token) => {
_tokens[token.address] = token;
return _tokens;
}, {});
return Object.assign({}, state, { tokens: objTokens });
}
return Object.assign({}, state, { tokens });
},