Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getBrowserCreateStore(findMatches, middleware = []) {
const middlewareToApply = [
catchMiddleware(console.error),
getApiMiddleware(findMatches, fetchQueries),
...middleware,
window.mupDevTools ? window.mupDevTools() : noopMiddleware, // must be last middleware
];
const middlewareEnhancer = applyMiddleware(...middlewareToApply);
const enhancer = compose(
middlewareEnhancer,
window.devToolsExtension ? window.devToolsExtension() : fn => fn // this must be last enhancer
);
return enhancer(createStore);
}
export function getBrowserCreateStore(resolveRoutes, middleware = []) {
const middlewareToApply = [
catchMiddleware(console.error),
getApiMiddleware(resolveRoutes, fetchQueries),
...middleware,
window.mupDevTools ? window.mupDevTools() : noopMiddleware, // must be last middleware
];
const middlewareEnhancer = applyMiddleware(...middlewareToApply);
const enhancer = compose(
middlewareEnhancer,
clickTrackEnhancer,
window.devToolsExtension ? window.devToolsExtension() : fn => fn // this must be last enhancer
);
return enhancer(createStore);
}
export function getServerCreateStore(routes, middleware, request, baseUrl) {
const middlewareToApply = [
catchMiddleware(err =>
request.server.app.logger.error({
err,
context: request,
...request.raw,
})
),
getApiMiddleware(routes, getFetchQueries(request), baseUrl),
...middleware,
];
const middlewareEnhancer = applyMiddleware(...middlewareToApply);
return middlewareEnhancer(createStore);
}
export function getServerCreateStore(findMatches, middleware, request) {
const middlewareToApply = [
catchMiddleware(err =>
request.server.app.logger.error({
err,
context: request,
})
),
getApiMiddleware(findMatches, getFetchQueries(request)),
...middleware,
];
const middlewareEnhancer = applyMiddleware(...middlewareToApply);
return middlewareEnhancer(createStore);
}