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 (customRequire, hotCallback, devMode) {
const reducer = combineReducers(Object.assign({}, {_gluestick}, customRequire()));
const composeArgs = [
applyMiddleware(promiseMiddleware, thunk)
];
// Include dev tools only if we are in development mode
if (devMode) {
composeArgs.push(DevTools.instrument());
}
const finalCreateStore = compose.apply(null, composeArgs)(createStore);
const store = finalCreateStore(reducer, typeof window !== "undefined" ? window.__INITIAL_STATE__ : {});
if (hotCallback) {
hotCallback(() => {
const nextReducer = combineReducers(Object.assign({}, {_gluestick}, customRequire()));
store.replaceReducer(nextReducer);
});
}
return store;
}
function getStoreAndDevTools(props) {
const {observable, hydrate, serialize, enhancers, children} = props;
for (let i = 0; i < devtoolRegistry.length; i++) {
let registration = devtoolRegistry[i];
// one observable can only have 1 devtool enabled
if (registration.observable == observable) {
return registration.result;
}
}
const ReduxDevTools = createDevTools(
{children}
);
const enhancer = compose.apply(this, [ReduxDevTools.instrument()].concat(enhancers))
const store = createStore(function (state={}, action) {
if (action.type != ActionTypes.MOBX_UPDATE) return state;
return action.state
}, serialize(observable), enhancer);
reaction(() => serialize(observable), state => {
if (observable.$mobx.fromJS) {
observable.$mobx.fromJS = false;
return;
}
store.dispatch({type: ActionTypes.MOBX_UPDATE, state})
});
const result = [store, ReduxDevTools];
devtoolRegistry.push({result, observable});
return result
};
return function (done) {
var chain = policies.map(function (policy) {
return policy(store);
});
return compose.apply(undefined, chain)(done);
};
};
const DevTools = createDevTools(
);
let stores = [applyMiddleware(promiseMiddleware)];
if (__DEV__ && __DEVTOOLS__) {
const { devTools, persistState } = require('redux-devtools');
stores.push(DevTools.instrument(), persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)));
}
const finalCreateStore = compose.apply(null, stores)(createStore);
const store = finalCreateStore(reducer, initialState);
const routes = createRoutes(function (nextState, transition, done) {
if(nextState.location.action === 'POP')
return done();
const components = nextState.routes.map(route => route.component);
fetchComponentData(store.dispatch, components, nextState.params)
return done();
});
if (__DEV__ && __DEVTOOLS__) {
render(
function() {
if (arguments.length === 0) return undefined;
if (typeof arguments[0] === 'object') return compose;
return compose.apply(null, arguments);
}
);
export default function configureStore(
data,
reducersMap,
middlewares = [],
enhancers = [],
) {
let store = createStore(
combinedReducers(reducersMap),
data,
compose.apply(
null,
[applyMiddleware.apply(null, middlewares)].concat(
enhancers.map(enhancer => enhancer()),
),
),
);
return store;
}
exports.composeWithDevTools = function() {
if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
if (arguments.length === 0) return enhancer();
if (typeof arguments[0] === 'object') return composeWithEnhancer(arguments[0]);
return composeWithEnhancer().apply(null, arguments);
}
if (arguments.length === 0) return undefined;
if (typeof arguments[0] === 'object') return compose;
return compose.apply(null, arguments);
};
export default function configureStore() {
const sagaMiddleware = createSagaMiddleware()
const composeArgs = [
applyMiddleware(sagaMiddleware),
applyMiddleware(thunk),
];
if(window && window.__REDUX_DEVTOOLS_EXTENSION__) {
composeArgs.push(window.__REDUX_DEVTOOLS_EXTENSION__());
}
const store = createStore(
rootReducer,
compose.apply(undefined, composeArgs)
);
sagaMiddleware.run(loginFlow);
sagaMiddleware.run(logActions);
return store;
}
return function () {
return compose(compose.apply(null, arguments), enhancer(config));
}
}