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-31 22:11:49 +05:30
|
|
|
|
import { syncHistory, routeReducer } from 'react-router-redux';
|
2016-01-03 01:54:07 +05:30
|
|
|
|
|
|
|
|
|
import { IntlProvider } from 'react-intl';
|
|
|
|
|
|
|
|
|
|
import reducers from 'reducers';
|
2016-02-13 20:58:47 +05:30
|
|
|
|
import routesFactory from 'routes';
|
2016-01-03 01:54:07 +05:30
|
|
|
|
|
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
|
|
|
|
|
2016-04-12 09:19:58 +05:30
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
|
|
|
// some shortcuts for testing on localhost
|
|
|
|
|
|
|
|
|
|
window.testOAuth = () => location.href = '/oauth?client_id=ely&redirect_uri=http%3A%2F%2Fely.by&response_type=code&scope=minecraft_server_session';
|
|
|
|
|
}
|
|
|
|
|
|
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}>
|
2016-02-13 20:58:47 +05:30
|
|
|
|
{routesFactory(store)}
|
2016-01-18 10:58:43 +05:30
|
|
|
|
</Router>
|
|
|
|
|
</ReduxProvider>
|
|
|
|
|
</IntlProvider>,
|
|
|
|
|
document.getElementById('app')
|
2016-01-03 01:54:07 +05:30
|
|
|
|
);
|