reverse caching: pass API into middleware

This commit is contained in:
Jannis R 2017-01-09 16:59:33 +01:00
parent 8c2aa4d87c
commit 61a42cc7e4
No known key found for this signature in database
GPG Key ID: 0FE83946296A88A5
2 changed files with 76 additions and 81 deletions

View File

@ -33,7 +33,7 @@ export default function (api, browserHistory) {
const certifications = new CertificationsMiddleware();
const routeMiddleware = routerMiddleware(browserHistory);
const chain = new ChainMiddleware();
const registry = new RegistryMiddleware();
const registry = new RegistryMiddleware(api);
const middleware = [
settings.toMiddleware(),
@ -41,7 +41,7 @@ export default function (api, browserHistory) {
errors.toMiddleware(),
certifications.toMiddleware(),
chain.toMiddleware(),
registry.toMiddleware()
registry
];
return middleware.concat(status, routeMiddleware, thunk);

View File

@ -21,10 +21,7 @@ import registryABI from '~/contracts/abi/registry.json';
import { setReverse, startCachingReverses } from './actions';
export default class RegistryMiddleware {
toMiddleware () {
return (store) => {
const api = Contracts.get()._api;
export default (api) => (store) => {
let contract, confirmedEvents, removedEvents, timeout, interval;
let addressesToCheck = {};
@ -105,6 +102,4 @@ export default class RegistryMiddleware {
next(action);
}
};
};
}
}
};