|
|
@ -1,6 +1,7 @@ |
|
|
|
import * as DrizzleActions from './drizzleStatus/drizzleActions' |
|
|
|
import * as ContractActions from './contracts/constants' |
|
|
|
import { ACCOUNTS_FETCHED } from './accounts/accountsActions' |
|
|
|
import { NETWORK_ID_CHANGED } from './web3/web3Actions' |
|
|
|
|
|
|
|
export const drizzleMiddleware = drizzleInstance => store => next => action => { |
|
|
|
const { type } = action |
|
|
@ -9,6 +10,14 @@ export const drizzleMiddleware = drizzleInstance => store => next => action => { |
|
|
|
drizzleInstance = action.drizzle |
|
|
|
} |
|
|
|
|
|
|
|
if (type === NETWORK_ID_CHANGED) { |
|
|
|
store.dispatch({ |
|
|
|
type: DrizzleActions.DRIZZLE_INITIALIZING, |
|
|
|
drizzle: drizzleInstance, |
|
|
|
options: drizzleInstance.options |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if ( |
|
|
|
type === ACCOUNTS_FETCHED && |
|
|
|
drizzleInstance && |
|
|
|