mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-27 18:58:08 +00:00
Review implemented
This commit is contained in:
parent
9844983e09
commit
8e13b49d2e
@ -14,10 +14,21 @@ export const initialState: Array<Fiat> = [];
|
|||||||
|
|
||||||
const update = (state: Array<Fiat>, action: FiatRateAction): Array<Fiat> => {
|
const update = (state: Array<Fiat>, action: FiatRateAction): Array<Fiat> => {
|
||||||
const newState: Array<Fiat> = [...state];
|
const newState: Array<Fiat> = [...state];
|
||||||
newState.push({
|
let exists: ?Fiat = newState.find(f => f.network === action.network);
|
||||||
network: action.network,
|
const { network, rate } = action;
|
||||||
value: action.rate.current_price.usd,
|
|
||||||
});
|
if (exists) {
|
||||||
|
exists = {
|
||||||
|
network,
|
||||||
|
value: rate,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
newState.push({
|
||||||
|
network,
|
||||||
|
value: rate,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return newState;
|
return newState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ const loadRateAction = (): AsyncAction => async (dispatch: Dispatch, getState: G
|
|||||||
dispatch({
|
dispatch({
|
||||||
type: RATE_UPDATE,
|
type: RATE_UPDATE,
|
||||||
network: response.symbol,
|
network: response.symbol,
|
||||||
rate: response.market_data,
|
rate: response.market_data.current_price.usd,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user