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';
|
|
|
|
|
import { syncReduxAndRouter, routeReducer } from 'redux-simple-router';
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
const store = applyMiddleware(
|
|
|
|
|
thunk
|
|
|
|
|
)(createStore)(reducer);
|
2016-01-03 01:54:07 +05:30
|
|
|
|
|
|
|
|
|
syncReduxAndRouter(browserHistory, store);
|
|
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
|
<IntlProvider locale="en" messages={{}}>
|
|
|
|
|
<ReduxProvider store={store}>
|
|
|
|
|
<Router history={browserHistory}>
|
|
|
|
|
{routes}
|
|
|
|
|
</Router>
|
|
|
|
|
</ReduxProvider>
|
|
|
|
|
</IntlProvider>,
|
|
|
|
|
document.getElementById('app')
|
|
|
|
|
);
|