-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
54 lines (49 loc) · 2.4 KB
/
index.js
File metadata and controls
54 lines (49 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import Main from './containers/Main';
import Vehicles from './containers/Vehicles';
import LaunchPage from './containers/Launch';
import ContentPage from './containers/Content';
import * as serviceWorker from './serviceWorker';
import {Provider} from 'react-redux';
import {createStore, applyMiddleware, compose} from 'redux';
import rootReducer from './reducers'
import {Router, Route, IndexRedirect, browserHistory} from 'react-router'
import {routerMiddleware, syncHistoryWithStore} from 'react-router-redux'
import identity from 'lodash/identity';
import AstronautPage from './containers/Astronaut';
import MissionPage from './containers/MissionPage';
const store = createStore(
rootReducer,
compose(
applyMiddleware(routerMiddleware(browserHistory)),
window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : identity,
)
);
const history = syncHistoryWithStore(browserHistory, store)
ReactDOM.render((
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<IndexRedirect to="/main" />
<Route path="/main" component={Main} />
<Route path="/vehicles" component={Vehicles} />
<Route path="/main/vehicles" component={Vehicles} />
<Route backToTitle="Main" backToUrl="/main" path="main/launches/:id" component={LaunchPage} />
<Route backToTitle="Launch vehicles" backToUrl="/vehicles" path="launches/:id" component={LaunchPage} />
<Route backToTitle="Launch vehicles" backToUrl="/vehicles" path="/vehicles/:id" component={ContentPage} />
<Route backToTitle="Main" backToUrl="/" path="/astronauts/:id" component={AstronautPage} />
<Route backToTitle="Main" backToUrl="/" path="/main/astronauts/:id" component={AstronautPage} />
<Route backToTitle="Main" backToUrl="/" path="/mission/:id" component={MissionPage} />
<Route backToTitle="Main" backToUrl="/" path="/main/mission/:id" component={MissionPage} />
<Route path="profile" component={LaunchPage} />
</Route>
</Router>
</Provider>
), document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();