forked from 81735595/mission-center
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
66 lines (56 loc) · 1.68 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import 'babel-polyfill'
import React from 'react'
import {render} from 'react-dom'
import {createStore, applyMiddleware} from 'redux'
import {Provider} from 'react-redux'
import thunk from 'redux-thunk'
import reducer from './reducers'
import {getList} from './actions/list'
import {changeNav} from './actions/nav'
import {getCategory} from './actions/dropdown'
import App from './containers/App'
let Url = require('url')
let middleware = []
let root = document.getElementById('mission-center-root')
if (root === null) {
root = document.body.appendChild(document.createElement('div'))
root.setAttribute('id', 'mission-center-root')
}
if (process.env.CTX_ENV && !window.$ctx) {
window.$ctx = process.env.CTX_ENV
}
if (process.env.NODE_ENV === "develop") {
let logger = require('redux-logger')
middleware.push(logger())
require('rc-tree/assets/index.css')
require('bootstrap/dist/css/bootstrap.css')
require('./style/bootstrap-reset.css')
require('./style/index.css')
require('./style/loading.css')
require('./style/iconfont/iconfont.css')
}
if (process.env.NODE_ENV === "build") {
require('bootstrap/dist/css/bootstrap.css')
require('rc-tree/assets/index.css')
require('./style/bootstrap-reset.css')
require('./style/index.css')
require('./style/loading.css')
require('./style/iconfont/iconfont.css')
}
middleware = [thunk].concat(middleware)
const store = createStore(
reducer,
applyMiddleware(...middleware)
)
let curNav = Url.parse(location.href, true).query.curNav - 0;
curNav = curNav || 0;
store.dispatch(changeNav(curNav));
store.dispatch(getList());
// 好像这个category没啥用啊
// store.dispatch(getCategory());
render(
<Provider store={store}>
<App />
</Provider>,
root
)