Use interface like named parameters here

This commit is contained in:
Steve Klebanoff
2018-11-09 11:28:08 -08:00
parent 474db7c18d
commit 36b8c9c5dd
2 changed files with 4 additions and 3 deletions

View File

@@ -36,10 +36,11 @@ export const asyncData = {
store.dispatch(actions.setAvailableAssets([]));
}
},
fetchAccountInfoAndDispatchToStore: async (store: Store, options = { setLoading: true }) => {
fetchAccountInfoAndDispatchToStore: async (options: { store: Store; setLoading: boolean }) => {
const { store, setLoading } = options;
const { providerState } = store.getState();
const web3Wrapper = providerState.web3Wrapper;
if (options.setLoading && providerState.account.state !== AccountState.Loading) {
if (setLoading && providerState.account.state !== AccountState.Loading) {
store.dispatch(actions.setAccountStateLoading());
}
let availableAddresses: string[];

View File

@@ -10,7 +10,7 @@ export interface HeartbeatFactoryOptions {
export const generateAccountHeartbeater = (options: HeartbeatFactoryOptions): Heartbeater => {
const { store, performImmediatelyOnStart } = options;
return new Heartbeater(async () => {
await asyncData.fetchAccountInfoAndDispatchToStore(store, { setLoading: false });
await asyncData.fetchAccountInfoAndDispatchToStore({ store, setLoading: false });
}, performImmediatelyOnStart);
};