import React from 'react';
|
import ReactDOM from 'react-dom';
|
import {Provider} from 'react-redux'
|
import Route from './router'
|
import store from '@/store'
|
import './index.css';
|
import * as serviceWorker from './serviceWorker';
|
|
const render = Component => {
|
ReactDOM.render(
|
<Provider store={store}>
|
<Component/>
|
</Provider>,
|
document.getElementById('root')
|
)
|
}
|
|
fetch(`./${process.env.NODE_ENV === 'production' ? 'build/' : ''}options.json`)
|
.then(response => response.json())
|
.catch(() => {
|
document.getElementById('root').innerHTML = '系统配置信息获取失败,请联系管理员!'
|
document.getElementById('root').className = 'config-error'
|
})
|
.then(config => {
|
if (!config) return
|
|
window.GLOB = {}
|
window.GLOB.appId = config.appId || ''
|
window.GLOB.lineColor = config.lineColor || ''
|
window.GLOB.filter = config.filter || ''
|
window.GLOB.appkey = config.appkey
|
|
render(Route)
|
})
|
|
serviceWorker.unregister();
|