reducer fix

This commit is contained in:
Mikhail Mikheev 2019-04-12 18:57:37 +04:00
parent f8d1e6801e
commit 413cfa39d4
4 changed files with 7 additions and 6 deletions

View File

@ -8,7 +8,7 @@ export type TokenProps = {
symbol: string, symbol: string,
decimals: number, decimals: number,
logoUri: string, logoUri: string,
balance: string balance: string,
} }
export const makeToken: RecordFactory<TokenProps> = Record({ export const makeToken: RecordFactory<TokenProps> = Record({

View File

@ -4,7 +4,7 @@ import updateActiveTokens from '~/routes/safe/store/actions/updateActiveTokens'
export type Actions = { export type Actions = {
fetchTokens: Function, fetchTokens: Function,
updateActiveTokens: Function updateActiveTokens: Function,
} }
export default { export default {

View File

@ -29,9 +29,7 @@ export const calculateBalanceOf = async (tokenAddress: string, safeAddress: stri
return new BigNumber(balance).div(10 ** decimals).toString() return new BigNumber(balance).div(10 ** decimals).toString()
} }
const fetchTokenBalances = (safe: Safe, tokens: List<Token>) => async ( const fetchTokenBalances = (safe: Safe, tokens: List<Token>) => async (dispatch: ReduxDispatch<GlobalState>) => {
dispatch: ReduxDispatch<GlobalState>,
) => {
if (!safe || !tokens || !tokens.size) { if (!safe || !tokens || !tokens.size) {
return return
} }

View File

@ -67,7 +67,10 @@ export default handleActions<State, *>(
return state.set(safe.address, safe) return state.set(safe.address, safe)
}, },
[UPDATE_SAFE_TOKENS]: (state: State, action: ActionType<Function>): [UPDATE_SAFE_TOKENS]: (state: State, action: ActionType<Function>): State => {
const { safeAddress, token } = action.payload
const tokens = state.getIn([safeAddress, 'tokens'])
}
}, },
Map(), Map(),
) )