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,
decimals: number,
logoUri: string,
balance: string
balance: string,
}
export const makeToken: RecordFactory<TokenProps> = Record({

View File

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

View File

@ -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<Token>) => async (
dispatch: ReduxDispatch<GlobalState>,
) => {
const fetchTokenBalances = (safe: Safe, tokens: List<Token>) => async (dispatch: ReduxDispatch<GlobalState>) => {
if (!safe || !tokens || !tokens.size) {
return
}

View File

@ -67,7 +67,10 @@ export default handleActions<State, *>(
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(),
)