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