-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·47 lines (42 loc) · 1.88 KB
/
index.js
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
import React from 'react'
import { render } from 'react-dom'
import { Router, Route, IndexRoute, hashHistory, browserHistory } from 'react-router'
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import reduxThunk from 'redux-thunk';
import createLogger from 'redux-logger';
import { AUTH_USER } from './src/actions/types'
import App from './src/Components/app'
import LandingPage from './src/Components/LandingPageComponents/landingPage'
import Viewer from './src/Components/ViewingComponent/viewing'
import Voting from './src/Components/VotingComponent/voteContainer'
import CreateAccountScreen from './src/Components/register'
import Login from './src/Components/login'
import Profile from './src/Components/ProfileViewComponents/profile'
import UploadNewVideo from './src/Components/ProfileViewComponents/uploadNewVideo'
import Search from './src/Components/search'
import reducers from './src/reducers/index'
const logger = createLogger();
const createStoreWithMiddleware = applyMiddleware(reduxThunk, logger)(createStore);
const store = createStoreWithMiddleware(reducers);
const token = JSON.parse(localStorage.getItem('token'));
if (token) {
store.dispatch({ type: AUTH_USER, payload: token })
}
render(
<Provider store={store}>
<Router history={hashHistory}>
<Route path="/" component={App}>
<IndexRoute component={LandingPage} />
<Route path="home" component={LandingPage}/>
<Route path="viewer" component={Viewer} />
<Route path="vote" component={Voting} />
<Route path="register" component={CreateAccountScreen} />
<Route path="login" component={Login} />
<Route path="profile" component={Profile} />
<Route path="NewVideo" component={UploadNewVideo} />
<Route path="search" component={Search} />
</Route>
</Router>
</Provider>
, document.getElementById('app'))