/* @flow */ import { RATE_UPDATE } from 'services/CoingeckoService'; import type { Action } from 'flowtype'; import type { FiatRateAction } from 'services/CoingeckoService'; export type Fiat = { +network: string; value: string; }; export const initialState: Array = []; const update = (state: Array, action: FiatRateAction): Array => { const newState: Array = [...state]; newState.push({ network: action.network, value: action.rate.current_price.usd, }); return newState; }; export default (state: Array = initialState, action: Action): Array => { switch (action.type) { case RATE_UPDATE: return update(state, action); default: return state; } };