Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* @copyright 2009-2018 Vanilla Forums Inc.
* @license GPL-2.0-only
*/
import { createStore, compose, applyMiddleware, combineReducers, Store } from "redux";
import { getReducers } from "@library/state/reducerRegistry";
import thunk from "redux-thunk";
import { createBrowserHistory } from "history";
import { connectRouter, routerMiddleware } from "connected-react-router";
const history = createBrowserHistory();
// There may be an initial state to import.
const initialState = {};
const initialActions = window.__ACTIONS__ || [];
const middleware = [thunk, routerMiddleware(history)];
// Browser may have redux dev tools installed, if so integrate with it.
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const enhancer = composeEnhancers(applyMiddleware(...middleware));
// Build the store, add devtools extension support if it's available.
let store;
export default function getStore<s>(): Store<s> {
if (store === undefined) {</s></s>
import MyStringStore from './contracts/MyStringStore.json';
// import css
import 'font-awesome/css/font-awesome.min.css';
import 'bulma/bulma.sass';
import './index.scss';
const auth = new Auth();
// let drizzle know what contracts we want
const options = { contracts: [MyStringStore] };
// setup the drizzle store and drizzle
const drizzleStore = generateStore(options);
const drizzle = new Drizzle(options, drizzleStore);
const history = createBrowserHistory();
ReactDOM.render((
function setupGlobalPlugins() {
// Use dot notation in the name attributes of the form inputs.
NSerializeJson.options.useDotSeparatorInPath = true;
};
function setupEvents() {
document.addEventListener('DOMContentLoaded', () => {
var preloader = document.getElementById("preloader");
preloader.classList.add("hidden");
});
};
// Create browser history to use in the Redux store.
const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href')!;
const history = createBrowserHistory({ basename: baseUrl });
// Get the application-wide store instance, prepopulating with state from the server where available.
const initialState = (window as any).initialReduxState as ApplicationState;
const store = configureStore(history, initialState);
function renderApp() {
// This code starts up the React app when it runs in a browser. It sets up the routing configuration
// and injects the app into a DOM element.
ReactDOM.hydrate(
,
document.getElementById('react-app')
);
import '@babel/polyfill';
import React from 'react';
import { hydrate } from 'react-dom';
import { createBrowserHistory as createHistory } from 'history';
import Root from './root';
import ApiClient from '../helpers/ApiClient';
import getRoutes from '../routes/routes';
import config from '../config';
import configureStore from '../redux/store';
const client = new ApiClient();
const initialState = window.__INITIAL_STATE__;
const history = createHistory();
const store = configureStore(history, client, initialState);
const dest = document.getElementById('root');
let renderApp = renderProps => hydrate(
,
dest
);
if (config.env === 'development') {
const RedBox = require('redbox-react').default;
const { AppContainer } = require('react-hot-loader');
renderApp = renderProps => hydrate(
import routingMiddleware from './middlewares/active-router'
import { I18nextProvider } from 'react-i18next'
import i18n from './i18n/i18n'
import { LocaleProvider } from 'antd'
import en_US from 'antd/lib/locale-provider/en_US'
import App from './containers/App'
import 'react-joyride/lib/react-joyride-compiled.css'
import 'nprogress/nprogress.css'
import 'react-table/react-table.css'
import './theme.less'
import './styles.less'
const history = createBrowserHistory()
const middleware = [thunk]
middleware.push(routingMiddleware);
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const store = createStore(
connectRouter(history)(rootReducer),
composeEnhancer(
applyMiddleware(
routerMiddleware(history),
...middleware,
),
),
)
const render = () => {
import React from 'react'
import ReactDOM from 'react-dom'
import {createBrowserHistory} from 'history'
import {fork, allSettled} from 'effector/fork'
import {App, app, location$, startClient} from './app'
const history = createBrowserHistory()
location$.updates.watch(location => {
if (history.location !== location) {
history.push(location)
}
})
const clientScope = fork(app, {
values: window.__initialState__,
})
allSettled(startClient, {
scope: clientScope,
params: history,
}).then(() => {
ReactDOM.hydrate(, document.getElementById('root'))
useEffect(() => {
const history = createBrowserHistory()
history.push(window.location.pathname + '')
}, [])
import { createBrowserHistory } from 'history';
const customHistory = createBrowserHistory();
export default customHistory;
CommonDataStore,
PageStore,
RealTimeStore
} from './stores';
import registerServiceWorker from './registerServiceWorker';
import { Root } from './containers/Root';
import './index.css';
import Container from './containers/Container';
import SignIn from './containers/Auth/signIn';
import SignUp from './containers/Auth/signUp';
import './macarons';
import 'echarts/map/js/world';
useStrict(true);
const browserHistory = createBrowserHistory();
const routerStore = new RouterStore();
const history = syncHistoryWithStore(browserHistory, routerStore);
const rootStore = {
token: new TokenStore(),
auth: new AuthStore(),
host: new HostStore(),
overview: new OverViewStore(),
assets: new AssetsStore(),
commmon: new CommonDataStore(),
page: new PageStore(),
realtime: new RealTimeStore(),
router: routerStore
};
ReactDOM.render(
get browserHistoryMultiplexer(): HistoryMultiplexer {
if (!browserHistoryMultiplexer) {
browserHistoryMultiplexer = new HistoryMultiplexer(
history.createBrowserHistory(),
rootLocationTransformer
);
}
return browserHistoryMultiplexer;
},