From 413cfa39d4084a684060ed7fd7ab6419919a7bb7 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Fri, 12 Apr 2019 18:57:37 +0400 Subject: [PATCH] reducer fix --- src/logic/tokens/store/model/token.js | 2 +- src/routes/safe/component/Balances/Tokens/actions.js | 2 +- src/routes/safe/store/actions/fetchTokenBalances.js | 4 +--- src/routes/safe/store/reducer/safe.js | 5 ++++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/logic/tokens/store/model/token.js b/src/logic/tokens/store/model/token.js index ab1c9a9b..bbe9ce3f 100644 --- a/src/logic/tokens/store/model/token.js +++ b/src/logic/tokens/store/model/token.js @@ -8,7 +8,7 @@ export type TokenProps = { symbol: string, decimals: number, logoUri: string, - balance: string + balance: string, } export const makeToken: RecordFactory = Record({ diff --git a/src/routes/safe/component/Balances/Tokens/actions.js b/src/routes/safe/component/Balances/Tokens/actions.js index 8ed94ed6..cf7ed193 100644 --- a/src/routes/safe/component/Balances/Tokens/actions.js +++ b/src/routes/safe/component/Balances/Tokens/actions.js @@ -4,7 +4,7 @@ import updateActiveTokens from '~/routes/safe/store/actions/updateActiveTokens' export type Actions = { fetchTokens: Function, - updateActiveTokens: Function + updateActiveTokens: Function, } export default { diff --git a/src/routes/safe/store/actions/fetchTokenBalances.js b/src/routes/safe/store/actions/fetchTokenBalances.js index 33236adf..6b41950a 100644 --- a/src/routes/safe/store/actions/fetchTokenBalances.js +++ b/src/routes/safe/store/actions/fetchTokenBalances.js @@ -29,9 +29,7 @@ export const calculateBalanceOf = async (tokenAddress: string, safeAddress: stri return new BigNumber(balance).div(10 ** decimals).toString() } -const fetchTokenBalances = (safe: Safe, tokens: List) => async ( - dispatch: ReduxDispatch, -) => { +const fetchTokenBalances = (safe: Safe, tokens: List) => async (dispatch: ReduxDispatch) => { if (!safe || !tokens || !tokens.size) { return } diff --git a/src/routes/safe/store/reducer/safe.js b/src/routes/safe/store/reducer/safe.js index 352fad20..941eb6e3 100644 --- a/src/routes/safe/store/reducer/safe.js +++ b/src/routes/safe/store/reducer/safe.js @@ -67,7 +67,10 @@ export default handleActions( return state.set(safe.address, safe) }, - [UPDATE_SAFE_TOKENS]: (state: State, action: ActionType): + [UPDATE_SAFE_TOKENS]: (state: State, action: ActionType): State => { + const { safeAddress, token } = action.payload + const tokens = state.getIn([safeAddress, 'tokens']) + } }, Map(), )