Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const configureStore = (cozyClient, persistedState) => {
// Enable Redux dev tools
const composeEnhancers =
(__DEVELOPMENT__ && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose
// middlewares
const middlewares = [thunkMiddleware]
if (shouldEnableTracking() && getTracker()) {
middlewares.push(createTrackerMiddleware())
}
if (flag('logs') && __DEVELOPMENT__) { // eslint-disable-line
// must be the last middleware in chain https://git.io/vHQpt
const loggerMiddleware = createLogger()
middlewares.push(loggerMiddleware)
}
if (isSentryEnabled()) {
middlewares.push(getSentryMiddleware(cozyClient))
}
const store = createStore(
combineReducers({
filters,
cozy: cozyClient.reducer()
}),
export const setupHistory = () => {
const piwikEnabled = shouldEnableTracking() && getTracker()
let history = hashHistory
if (piwikEnabled) {
const trackerInstance = getTracker()
history = trackerInstance.connectToHistory(history)
trackerInstance.track(history.getCurrentLocation()) // when using a hash history, the initial visit is not tracked by piwik react router
}
return history
}