diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-09 09:13:22 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-09 09:13:22 +0800 |
commit | 297a62fe80142897250f6dd6fddb4cdf1d3fe3ee (patch) | |
tree | 92bd8ba2f27d9144bdc1c8fbfda5b50e81015dd5 /packages/instant/src/util/heartbeater_factory.ts | |
parent | 1e39d56cf751fd922d6fec86ecc8bc70b20bc6bb (diff) | |
download | dexon-sol-tools-297a62fe80142897250f6dd6fddb4cdf1d3fe3ee.tar.gz dexon-sol-tools-297a62fe80142897250f6dd6fddb4cdf1d3fe3ee.tar.zst dexon-sol-tools-297a62fe80142897250f6dd6fddb4cdf1d3fe3ee.zip |
move files around and rename
Diffstat (limited to 'packages/instant/src/util/heartbeater_factory.ts')
-rw-r--r-- | packages/instant/src/util/heartbeater_factory.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/instant/src/util/heartbeater_factory.ts b/packages/instant/src/util/heartbeater_factory.ts new file mode 100644 index 000000000..fc33787ee --- /dev/null +++ b/packages/instant/src/util/heartbeater_factory.ts @@ -0,0 +1,18 @@ +import { asyncData } from '../redux/async_data'; +import { Store } from '../redux/store'; + +import { updateBuyQuoteOrFlashErrorAsyncForState } from './buy_quote_fetcher'; +import { Heartbeater } from './heartbeater'; + +export const generateAccountHeartbeater = (store: Store): Heartbeater => { + return new Heartbeater(async () => { + await asyncData.fetchAccountInfoAndDispatchToStore(store, { setLoading: false }); + }); +}; + +export const generateBuyQuoteHeartbeater = (store: Store): Heartbeater => { + return new Heartbeater(async () => { + await updateBuyQuoteOrFlashErrorAsyncForState(store.getState(), store.dispatch); + return Promise.resolve(); + }); +}; |