blob: 4ed89bdc32ff69a5c19e255c93f6f27eaed43516 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import { BIG_NUMBER_ZERO } from '../constants';
import { coinbaseApi } from '../util/coinbase_api';
import { ActionTypes } from './actions';
import { Store } from './store';
export const asyncData = {
fetchAndDispatchToStore: async (store: Store) => {
let ethUsdPrice = BIG_NUMBER_ZERO;
try {
ethUsdPrice = await coinbaseApi.getEthUsdPrice();
} catch (e) {
// ignore
} finally {
store.dispatch({
type: ActionTypes.UPDATE_ETH_USD_PRICE,
data: ethUsdPrice,
});
}
},
};
|