static-cms/src/index.js

36 lines
941 B
JavaScript
Raw Normal View History

2016-02-25 00:45:56 -08:00
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
2016-07-15 15:05:04 -03:00
import { Router } from 'react-router';
2016-09-11 23:08:18 +02:00
import registry from './lib/registry';
2016-02-25 00:45:56 -08:00
import configureStore from './store/configureStore';
2016-07-15 15:05:04 -03:00
import routes from './routing/routes';
import history, { syncHistory } from './routing/history';
2016-02-25 00:45:56 -08:00
import 'file?name=index.html!../example/index.html';
2016-07-08 07:12:52 -03:00
import './index.css';
2016-02-25 00:45:56 -08:00
const store = configureStore();
2016-07-18 15:07:59 -03:00
// Create an enhanced history that syncs navigation events with the store
syncHistory(store);
2016-02-25 00:45:56 -08:00
const el = document.createElement('div');
2016-07-05 15:48:18 -03:00
el.id = 'root';
2016-02-25 00:45:56 -08:00
document.body.appendChild(el);
render((
<Provider store={store}>
<Router history={history}>
{routes}
</Router>
2016-02-25 00:45:56 -08:00
</Provider>
), el);
2016-09-11 23:08:18 +02:00
window.CMS = {};
console.log('reg: ', registry);
for (const method in registry) {
window.CMS[method] = registry[method];
}
2016-09-12 15:27:45 +02:00
window.createClass = React.createClass;
window.h = React.createElement;