Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const sharedStateCb = ({ dispatch, getState }) => {
const state = getState();
const syncEnabled = makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state);
const emailVerified = selectUserVerifiedEmail(state);
if (syncEnabled && emailVerified) {
getSavedPassword().then(savedPassword => {
dispatch(doGetSync(savedPassword));
});
}
};
const sharedStateMiddleware = buildSharedStateMiddleware(triggerSharedStateActions, sharedStateFilters, sharedStateCb);
const rootReducer = createRootReducer(history);
const persistedReducer = persistReducer(persistOptions, rootReducer);
const bulkThunk = createBulkThunkMiddleware();
const middleware = [sharedStateMiddleware, routerMiddleware(history), thunk, bulkThunk];
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(
enableBatching(persistedReducer),
{}, // initial state
composeEnhancers(applyMiddleware(...middleware))
);
const persistor = persistStore(store);
window.persistor = persistor;
export { store, persistor, history, whiteListedReducers };
import rootSaga from './sagas/combined';
import createSagaMiddleware from 'redux-saga';
const sagaMiddleware = createSagaMiddleware();
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
import * as actions from './constants';
import { createBrowserHistory } from 'history'
import { routerMiddleware, ConnectedRouter } from 'connected-react-router';
import { Route, Switch } from 'react-router'
const history = createBrowserHistory();
// then run the saga
const store = createStore(createRouteReducers(history), composeEnhancers(applyMiddleware(routerMiddleware(history), sagaMiddleware)));
sagaMiddleware.run(rootSaga);
export const action = type => store.dispatch({ type });
action(actions.INITALIZE_APPLICATION);
import AppContainer from './containers/App';
import Error from './components/Error';
render(
<div>
</div>
function Booto(){
if(BootoNumber === 1){
throw new Error('Booto can new only once!');
}
BootoNumber = 1;
this.history = createBrowserHistory();
this.middleWares = [routerMiddleware(this.history),promiseMiddle];
}
export const onAppCreate = async (modules: ClientModule, entryModule: NodeModule) => {
ref.modules = modules;
ref.client = createApolloClient({
apiUrl,
createNetLink: ref.modules.createNetLink,
createLink: ref.modules.createLink,
connectionParams: ref.modules.connectionParams,
clientResolvers: ref.modules.resolvers
});
if (entryModule.hot && entryModule.hot.data && entryModule.hot.data.store) {
ref.store = entryModule.hot.data.store;
ref.store.replaceReducer(getStoreReducer(history, ref.modules.reducers));
} else {
ref.store = createReduxStore(ref.modules.reducers, {}, history, routerMiddleware(history));
}
};
export default function(history) {
const middleware = applyMiddleware(
requestPromiseMiddleware,
routerMiddleware(history),
createLogicMiddleware(logics),
)
return createStore(connectRouter(history)(reducer), composeEnhancers(middleware))
}
const devMode = process.env.DEVMODE || 'local';
const persistConfig = {
key: 'root',
storage,
//whitelist: ['cluster', 'storage', 'plan'],
whitelist: [],
};
const persistedReducer = persistReducer(persistConfig, rootReducer);
const sagaMiddleware = createSagaMiddleware();
const enhancers = [];
const logger = createLogger({collapsed: true});
const middleware = [thunk, logger, sagaMiddleware, routerMiddleware(history)];
if (devMode === 'local') {
const devToolsExtension = window.__REDUX_DEVTOOLS_EXTENSION__;
if (typeof devToolsExtension === 'function') {
enhancers.push(devToolsExtension());
}
}
const composedEnhancers = compose(
applyMiddleware(...middleware),
...enhancers
);
export default () => {
const store = createStore(persistedReducer, composedEnhancers);
sagaMiddleware.run(rootSaga);
export default (history: History, initialState?: State) => {
const rootReducer = connectRouter(history)(reducer);
const epicMiddleware = createEpicMiddleware(rootEpic);
const enhancers = composeWithDevTools(
applyMiddleware(
routerMiddleware(history),
epicMiddleware
),
autoRehydrate()
);
const store = initialState
? createStore(rootReducer, initialState, enhancers)
: createStore(rootReducer, enhancers);
persistStore(store, {
keyPrefix: "fttv:",
whitelist: ["settings", "user"]
});
if ((process.env.NODE_ENV === "development") && module.hot) {
module.hot.accept("data", () => {
locks: defaultLocks,
modals: defaultModals,
network: defaultNetwork,
provider: defaultProvider,
transactions: defaultTransactions,
currency: defaultCurrency,
errors: defaultError,
walletStatus: defaultWalletStatus,
},
{
provider: Object.keys(config.providers)[0],
},
defaultState
)
middlewares.push(routerMiddleware(history))
const composeEnhancers =
(global.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
trace: true,
traceLimit: 25,
})) ||
compose
return createStore(
combineReducers(reducers),
initialState,
composeEnhancers(applyMiddleware(...middlewares))
)
}
...reducers,
};
const defaultReducer = (s = {}) => s;
const AppReducers = combineReducers(
Object.keys(defaultStore).reduce((result, key) => {
return Object.assign({}, result, {
[key]: reducers[key] ? reducers[key] : defaultReducer,
});
}, reducerList),
);
const sagaMiddleware = createSagaMiddleware();
const createStoreWithFirebase = compose(
reactReduxFirebase(firebase, process.env.firebase),
composeWithDevTools(applyMiddleware(routerMiddleware(history), thunk, sagaMiddleware)),
)(createStore);
const rootReducer = reduceReducers(AppReducers, dataReducer);
const store = createStoreWithFirebase(connectRouter(history)(rootReducer), defaultStore);
sagaMiddleware.run(rootSaga);
export default store;