2017-09-24 19:06:28 -07:00
|
|
|
import { FiatSucceededRatesAction, RatesAction } from 'actions/rates';
|
|
|
|
import { TypeKeys } from 'actions/rates/constants';
|
2017-07-14 01:02:39 +04:00
|
|
|
// SYMBOL -> PRICE TO BUY 1 ETH
|
2017-09-24 19:06:28 -07:00
|
|
|
export interface State {
|
|
|
|
[key: string]: number;
|
|
|
|
}
|
2017-07-14 01:02:39 +04:00
|
|
|
|
2017-07-27 13:05:09 -04:00
|
|
|
export const INITIAL_STATE: State = {};
|
2017-07-14 01:02:39 +04:00
|
|
|
|
2017-09-12 15:15:23 -07:00
|
|
|
function fiatSucceededRates(
|
|
|
|
state: State,
|
|
|
|
action: FiatSucceededRatesAction
|
|
|
|
): State {
|
2017-07-14 01:02:39 +04:00
|
|
|
return action.payload;
|
|
|
|
}
|
|
|
|
|
2017-07-27 13:05:09 -04:00
|
|
|
export function rates(
|
|
|
|
state: State = INITIAL_STATE,
|
|
|
|
action: RatesAction
|
|
|
|
): State {
|
2017-07-14 01:02:39 +04:00
|
|
|
switch (action.type) {
|
2017-09-24 19:06:28 -07:00
|
|
|
case TypeKeys.RATES_FIAT_SUCCEEDED:
|
2017-09-12 15:15:23 -07:00
|
|
|
return fiatSucceededRates(state, action);
|
2017-07-14 01:02:39 +04:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|