2016-01-03 01:54:07 +05:30
|
|
|
|
import 'babel-polyfill';
|
|
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
|
|
2016-01-03 14:41:08 +05:30
|
|
|
|
import { createStore, combineReducers, applyMiddleware } from 'redux';
|
2016-01-03 01:54:07 +05:30
|
|
|
|
import { Provider as ReduxProvider } from 'react-redux';
|
|
|
|
|
|
2016-01-03 14:41:08 +05:30
|
|
|
|
// midleware, который позволяет возвращать из экшенов функции
|
|
|
|
|
// это полезно для работы с асинхронными действиями,
|
|
|
|
|
// а также дает возможность проверить какие-либо условия перед запуском экшена
|
|
|
|
|
// или даже вообще его не запускать в зависимости от условий
|
|
|
|
|
import thunk from 'redux-thunk';
|
|
|
|
|
|
2016-01-03 01:54:07 +05:30
|
|
|
|
import { Router, browserHistory } from 'react-router';
|
2016-01-18 10:58:43 +05:30
|
|
|
|
import { syncHistory, routeReducer } from 'redux-simple-router';
|
2016-01-03 01:54:07 +05:30
|
|
|
|
|
|
|
|
|
import { IntlProvider } from 'react-intl';
|
|
|
|
|
|
|
|
|
|
import reducers from 'reducers';
|
|
|
|
|
import routes from 'routes';
|
|
|
|
|
|
2016-01-04 02:48:42 +05:30
|
|
|
|
import 'index.scss';
|
|
|
|
|
|
2016-01-03 01:54:07 +05:30
|
|
|
|
const reducer = combineReducers({
|
|
|
|
|
...reducers,
|
|
|
|
|
routing: routeReducer
|
|
|
|
|
});
|
2016-01-03 14:41:08 +05:30
|
|
|
|
|
2016-01-18 10:58:43 +05:30
|
|
|
|
const reduxRouterMiddleware = syncHistory(browserHistory);
|
|
|
|
|
|
2016-01-03 14:41:08 +05:30
|
|
|
|
const store = applyMiddleware(
|
2016-01-18 10:58:43 +05:30
|
|
|
|
reduxRouterMiddleware,
|
2016-01-03 14:41:08 +05:30
|
|
|
|
thunk
|
|
|
|
|
)(createStore)(reducer);
|
2016-01-03 01:54:07 +05:30
|
|
|
|
|
|
|
|
|
ReactDOM.render(
|
2016-01-18 10:58:43 +05:30
|
|
|
|
<IntlProvider locale="en" messages={{}}>
|
|
|
|
|
<ReduxProvider store={store}>
|
|
|
|
|
<Router history={browserHistory}>
|
|
|
|
|
{routes}
|
|
|
|
|
</Router>
|
|
|
|
|
</ReduxProvider>
|
|
|
|
|
</IntlProvider>,
|
|
|
|
|
document.getElementById('app')
|
2016-01-03 01:54:07 +05:30
|
|
|
|
);
|