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 function createReducer(injectedReducers = {}) {
const rootReducer = combineReducers({
global: globalReducer,
form: formReducer,
language: languageProviderReducer,
...injectedReducers,
});
// Wrap the root reducer and return a new root reducer with router state
const mergeWithRouterState = connectRouter(history);
return mergeWithRouterState(rootReducer);
}
export default function createReducer(injectedReducers = {}) {
const rootReducer = combineReducers({
form,
login,
ui: uiReducer,
initval,
language: languageProviderReducer,
router: connectRouter(history),
...injectedReducers,
});
// Wrap the root reducer and return a new root reducer with router state
const mergeWithRouterState = connectRouter(history);
return mergeWithRouterState(rootReducer);
}
export default function createReducer(injectedReducers = {}) {
const rootReducer = combineReducers({
global: globalReducer,
language: languageProviderReducer,
...injectedReducers,
});
// Wrap the root reducer and return a new root reducer with router state
const mergeWithRouterState = connectRouter(history);
return mergeWithRouterState(rootReducer);
}
export default function configureStore<s>(
initialState: S,
history: History,
): InjectableStore {
const nonInjectedReducers = {
language: languageProviderReducer as Reducer,
router: connectRouter(history) as Reducer,
};
// Create the store with two middlewares
// 1. sagaMiddleware: Makes redux-sagas work
// 2. routerMiddleware: Syncs the location/URL path to the state
const middlewares = [sagaMiddleware, routerMiddleware(history)];
const enhancers = [applyMiddleware(...middlewares)];
const windowCast = window ? (window as any) : null;
// If Redux DevTools Extension is installed use it, otherwise use Redux compose
const composeEnhancers =
process.env.NODE_ENV !== 'production' &&
windowCast &&
// eslint-disable-next-line no-underscore-dangle</s>
export default function createReducer(injectedReducers = {}) {
const rootReducer = combineReducers({
language: languageProviderReducer,
...injectedReducers,
});
// Wrap the root reducer and return a new root reducer with router state
const mergeWithRouterState = connectRouter(history);
return mergeWithRouterState(rootReducer);
}
export default function createReducer(injectedReducers = {}) {
const rootReducer = combineReducers({
language: languageProviderReducer,
...injectedReducers,
});
// Wrap the root reducer and return a new root reducer with router state
const mergeWithRouterState = connectRouter(history);
return mergeWithRouterState(rootReducer);
}
const configureStoreDev = () => {
const middlewares = [
sagaMiddleware,
routerMiddleware(history),
loggerMiddleware
];
const store = createStore(
connectRouter(history)(rootReducer),
initialState,
applyMiddleware(...middlewares)
);
if (module.hot) {
module.hot.accept('./rootReducer', () => {
const nextReducer = require('./rootReducer').default;
store.replaceReducer(nextReducer);
});
}
sagaMiddleware.run(rootSaga);
return store;
};
export const rootReducer = (history: any) => combineReducers({
locale,
imageGallery: imageGalleryReducer,
post: postReducer,
circle: circleReducer,
comment: commentReducer,
vote: voteReducer,
server: serverReducer,
authorize: authorizeReducer,
router: connectRouter(history),
user: userReducer,
notify: notificationReducer,
global: globalReducer
} as any)
const rootReducer = history => combineReducers({
router: connectRouter(history),
home,
});
export default (history: History) => {
const sagaMiddleware = createSagaMiddleware();
const enhancer = composeWithDevTools(applyMiddleware(
sagaMiddleware,
routerMiddleware(history),
));
const store = createStore(
connectRouter(history)(rootReducer),
enhancer,
);
let sagaTask = sagaMiddleware.run(rootSaga);
const hot = (module as any).hot;
if (hot) {
hot.accept('./rootReducer', () => {
const reducer = require('./rootReducer').default;
store.replaceReducer(connectRouter(history)(reducer));
});
hot.accept('./rootSaga', () => {
sagaTask.cancel();
sagaTask.done.then(() => {
sagaTask = sagaMiddleware.run(require('./rootSaga').default);
});