2017-07-13 21:02:39 +00:00
|
|
|
// @flow
|
|
|
|
import type { SetRatesAction, RatesAction } from 'actions/rates';
|
|
|
|
|
|
|
|
// SYMBOL -> PRICE TO BUY 1 ETH
|
|
|
|
export type State = {
|
|
|
|
[key: string]: number
|
|
|
|
};
|
|
|
|
|
2017-07-27 17:05:09 +00:00
|
|
|
export const INITIAL_STATE: State = {};
|
2017-07-13 21:02:39 +00:00
|
|
|
|
|
|
|
function setRates(state: State, action: SetRatesAction): State {
|
|
|
|
return action.payload;
|
|
|
|
}
|
|
|
|
|
2017-07-27 17:05:09 +00:00
|
|
|
export function rates(
|
|
|
|
state: State = INITIAL_STATE,
|
|
|
|
action: RatesAction
|
|
|
|
): State {
|
2017-07-13 21:02:39 +00:00
|
|
|
switch (action.type) {
|
|
|
|
case 'RATES_SET':
|
|
|
|
return setRates(state, action);
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|