Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable no-underscore-dangle */
const composeEnhancers =
process.env.NODE_ENV !== 'production' &&
typeof window === 'object' &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
: compose;
store = createStore(
createReducer(),
initialState,
composeEnhancers(...enhancers)
);
// Check to ensure latest build version
storage
.getItem('buildVersion')
.then(localVersion => {
if (localVersion !== buildVersion) {
// Purge store
persistStore(store).purge();
// Save the new build version in the local cache
storage.setItem('buildVersion', buildVersion);
} else {
persistStore(store);
}
})
.catch(() => {
persistStore(store);
storage.setItem('buildVersion', buildVersion);
});