Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default (initialState = DEFAULT_STATE) => {
// We do not want middlewares like redux-logger to get
// fired on the server side
if (isServer) {
return createStore(reducers, initialState, applyMiddleware(thunk.withExtraArgument(socket)));
} else {
initialState = deepmerge(
load({ states: localStorageStates, namespace: packageJson.name }),
initialState,
);
return createStore(
reducers,
initialState,
applyMiddleware(logger,
save({ states: localStorageStates, namespace: packageJson.name }),
thunk.withExtraArgument(socket)),
);
}
};
export default function configureStore() {
// In SSR, we can't access localStorage, so we need to build the store without
// save/load support. I think this is fine though.
let store;
if (typeof window === 'undefined') {
store = createStore(rootReducer);
} else {
store = createStore(
rootReducer,
load(reduxLocalStorageConfig),
applyMiddleware(save(reduxLocalStorageConfig))
);
}
return store;
}
export default function configureStore() {
const store = createStore(
rootReducer,
load(reduxLocalStorageConfig),
compose(
applyMiddleware(focusManagerMiddleware, save(reduxLocalStorageConfig)),
DevTools.instrument()
)
);
// Allow direct access to the store, for debugging/testing
window.store = store;
return store;
}
export default function configureStore() {
// In SSR, we can't access localStorage, so we need to build the store without
// save/load support. I think this is fine though.
let store;
if (typeof window === 'undefined') {
store = createStore(rootReducer);
} else {
store = createStore(
rootReducer,
load(reduxLocalStorageConfig),
applyMiddleware(save(reduxLocalStorageConfig))
);
}
return store;
}
export default (initialState = DEFAULT_STATE) => {
// We do not want middlewares like redux-logger to get
// fired on the server side
if (isServer) {
return createStore(reducers, initialState, applyMiddleware(thunk.withExtraArgument(socket)));
} else {
initialState = deepmerge(
load({ states: localStorageStates, namespace: packageJson.name }),
initialState,
);
return createStore(
reducers,
initialState,
applyMiddleware(logger,
save({ states: localStorageStates, namespace: packageJson.name }),
thunk.withExtraArgument(socket)),
);
}
};
import { createStore, combineReducers, applyMiddleware, compose } from 'redux'
import { routerReducer, routerMiddleware } from 'react-router-redux'
import { save as makeSaver, load as makeLoader } from 'redux-localstorage-simple'
import { spyMiddleware } from 'middleware'
import appReducer from 'duck'
const save = makeSaver({ debounce: 1000 }) // middleware
// eslint-disable-next-line no-underscore-dangle
const composeEnhancers = (typeof window === 'object' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)
// eslint-disable-next-line no-underscore-dangle
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ shouldHotReload: false })
: compose
export default function configureStore(history) {
const middleware = applyMiddleware(routerMiddleware(history), spyMiddleware, save)
const enhancer = composeEnhancers(middleware)
return createStore(
combineReducers({
app: appReducer,
router: routerReducer,
}),
export default function configureStore() {
const store = createStore(
rootReducer,
load(reduxLocalStorageConfig),
compose(
applyMiddleware(focusManagerMiddleware, save(reduxLocalStorageConfig)),
DevTools.instrument()
)
);
// Allow direct access to the store, for debugging/testing
window.store = store;
return store;
}
export function getStorageData( states = [], preloadedState = {} ) {
return load( {
states,
namespace,
preloadedState,
disableWarnings: true,
} );
}