Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// support for redux dev tools
const compose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || reduxCompose
const store = createStore(
combineReducers({
form,
resource,
...reducers,
}),
initialState,
compose(
applyMiddleware(...[
createEpicMiddleware(combineEpics(...epics, resourceEpic), { dependencies: { API } }),
cacheMiddleware,
process.env.SENTRY_DSN && createSentryMiddleware(Sentry, {
stateTransformer: (state) => { return omit(state, 'session') },
}),
].filter(Boolean))
)
)
// FIXME API should not need store
configureAPI(store)
const history = createBrowserHistory()
export {
store,
history,
}
import { GitEpic } from './epic/github';
// Application Reducers
const rootReducer = combineReducers({
counterReducer: counterReducer,
todoReducer: todoReducer,
gitReducer: githubReducer
});
export const rootEpic = combineEpics(
GitEpic.getRepoData,
GitEpic.getFollowersData
// more epics functions go here
)
const epicMiddleware = createEpicMiddleware(rootEpic);
const createStoreWithMiddleware = applyMiddleware(epicMiddleware);
export let store = createStore(rootReducer, createStoreWithMiddleware);
/* @flow strict */
import { middlewares as coreMiddlewares } from "@nteract/core";
import { createEpicMiddleware, combineEpics } from "redux-observable";
import logger from "./logger.js";
import epics from "./epics/index.js";
const rootEpic = combineEpics(...epics);
const middlewares = [
createEpicMiddleware(rootEpic),
coreMiddlewares.errorMiddleware
];
if (process.env.DEBUG === "true") {
middlewares.push(logger());
}
export default middlewares;
import { createStore, applyMiddleware, compose } from 'redux';
import { createEpicMiddleware } from 'redux-observable';
import { routerMiddleware } from 'connected-react-router';
import history from 'renderer/history';
import { createLogger } from 'redux-logger';
import gaMiddleware from './middlewares/analytics';
import rootReducer from '../reducers';
import epics from '../epics';
const middleware = [];
const epicMiddleware = createEpicMiddleware();
middleware.push(epicMiddleware);
const LOG_REDUX = false;
// Skip redux logs in console during the tests
if (process.env.NODE_ENV !== 'test' && LOG_REDUX) {
// Logging Middleware
const logger = createLogger({
level: 'info',
collapsed: true,
});
middleware.push(logger);
}
middleware.push(routerMiddleware(history));
middleware.push(gaMiddleware({ logger: false }));
export default function configureStore(initialState, helpersConfig) {
const helpers = createHelpers(helpersConfig);
const sagaMiddleware = createSagaMiddleware();
const epicMiddleware = createEpicMiddleware(epics);
const middlewares = [
epicMiddleware,
sagaMiddleware,
thunk.withExtraArgument(helpers)
// beforeLoggerMiddleware,
// afterLoggerMiddleware,
];
let enhancer;
if (__DEV__) {
middlewares.push(createLogger());
// https://github.com/zalmoxisus/redux-devtools-extension#redux-devtools-extension
let devToolsExtension = f => f;
import * as React from "react";
import * as ReactDOM from "react-dom";
import {createStore} from "redux";
import {createEpicMiddleware} from "redux-observable";
import {pingEpic, pingReducer} from "./reducers/reducer";
import {applyMiddleware} from "redux";
import {Provider} from "react-redux";
import App from "./containers/App";
const epicMiddleware = createEpicMiddleware(pingEpic);
//noinspection TypeScriptValidateTypes
let store = createStore(pingReducer,applyMiddleware(epicMiddleware));
ReactDOM.render(
<div>
</div>,
document.querySelector("#ct")
);
const appInitialState = {
page: initialState,
};
const appEpic = combineEpics(
epic,
patchEpicStore(s => s.common.cookieConsent, cookieConsentEpic)
);
const store = createReduxStore(
appReducer,
appInitialState,
compose(
customMiddleware,
applyMiddleware(thunk),
applyMiddleware(createEpicMiddleware(appEpic)),
window.devToolsExtension ? window.devToolsExtension() : f => f
)
);
return store;
};
module.exports = (plugins, custom) => {
const allReducers = combineReducers(plugins, {
locale: require('../../reducers/locale'),
browser: require('../../reducers/browser'),
theme: require('../../reducers/theme'),
map: () => {return null; },
mapInitialConfig: () => {return null; },
layers: () => {return null; },
pluginsConfig: require('./reducers/config'),
custom
});
const standardEpics = {
...require('../../epics/controls')
};
const rootEpic = combineEpics(plugins, {...standardEpics });
const epicMiddleware = createEpicMiddleware(rootEpic);
const rootReducer = (state, action) => {
if (action.type === 'LOADED_STATE') {
return action.state;
}
let mapState = LayersUtils.splitMapAndLayers(mapConfig(state, action));
let newState = {
...allReducers(state, action),
map: mapState && mapState.map ? map(mapState.map, action) : null,
mapInitialConfig: mapState ? mapState.mapInitialConfig : null,
layers: mapState ? layers(mapState.layers, action) : null
};
return newState;
};
return createDebugStore(rootReducer, {}, [epicMiddleware]);
import { createStore, applyMiddleware } from 'redux';
import createLogger from 'redux-logger';
import { createEpicMiddleware } from 'redux-observable';
import { browserHistory } from 'react-router';
import { routerMiddleware } from 'react-router-redux';
import { rootEpic } from '../actions/index';
import rootReducer from '../reducers/index';
const logger = createLogger();
const router = routerMiddleware(browserHistory);
const epicMiddleware = createEpicMiddleware(rootEpic);
const createStoreWithMiddleware = applyMiddleware(epicMiddleware, router)(createStore);
export default function configureStore(initialState) {
return createStoreWithMiddleware(rootReducer, initialState);
}
import React from 'react';
import * as counterActions from './counterActionCreators';
import * as types from '../../../constants/actionTypes';
import counterReducer, { initialState } from './counterReducer';
//Include Redux Observable For 'Epic' Creation
import { epics } from '../../../_Epics';
import { createEpicMiddleware } from 'redux-observable';
const epicMiddleware = createEpicMiddleware(epics);
import { Map } from 'immutable';
//For testing components
import { shallow } from 'enzyme';
import renderer from 'react-test-renderer';
import configureStore from 'redux-mock-store';
const middlewares = [epicMiddleware]; //eg: [thunk] for async | eg: [epicMiddleware] for testing epics
const mockStore = configureStore(middlewares);
//Component to be Tested
import CounterClicker from './index';
//Test suite designed to test the functionality of
describe('Counter Test Suite', () => {
let store;