1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/index.jsx

39 lines
1.2 KiB
React
Raw Normal View History

2016-12-22 14:09:16 +01:00
import 'whatwg-fetch';
import 'react-mdl/extra/material.css';
import 'react-mdl/extra/material.js';
2016-11-10 14:26:24 +01:00
import React from 'react';
import ReactDOM from 'react-dom';
import { HashRouter, Route } from 'react-router-dom';
2016-11-10 14:26:24 +01:00
import { Provider } from 'react-redux';
import thunkMiddleware from 'redux-thunk';
2017-01-06 11:52:44 +01:00
import { createStore, applyMiddleware, compose } from 'redux';
2016-11-10 14:26:24 +01:00
import store from './store';
2018-01-29 09:07:10 +01:00
import MetricsPoller from './metrics-poller';
2016-11-10 14:26:24 +01:00
import App from './component/app';
import ScrollToTop from './component/scroll-to-top';
2016-11-10 14:26:24 +01:00
2017-01-06 11:52:44 +01:00
let composeEnhancers;
2017-08-28 21:40:44 +02:00
if (process.env.NODE_ENV !== 'production' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
2017-01-06 11:52:44 +01:00
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
} else {
composeEnhancers = compose;
}
2017-08-28 21:40:44 +02:00
const unleashStore = createStore(store, composeEnhancers(applyMiddleware(thunkMiddleware)));
2018-01-29 09:07:10 +01:00
const metricsPoller = new MetricsPoller(unleashStore);
metricsPoller.start();
2016-11-10 14:26:24 +01:00
ReactDOM.render(
<Provider store={unleashStore}>
<HashRouter>
<ScrollToTop>
<Route path="/" component={App} />
</ScrollToTop>
</HashRouter>
</Provider>,
document.getElementById('app')
);