index.js 1.18 KB
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import reportWebVitals from './reportWebVitals'
import 'antd/dist/antd.css'
import { init } from 'loading-bar'
import 'loading-bar/src/index.css'
import store from './store'
import { install } from 'system-collect'
import http from './libs/fetch'
import { APP } from './config/index'
import { setAPP } from 'xbd-cookie'
setAPP(APP)
init()

store.dispatch.baseConfig.init()
.then(res => {
  if(!res) {
    console.error('平台配置参数未获取', res)
    return
  }
  http.setHeader('operationChannel', res.operationChannel)
  install(
    process.env.REACT_APP_API === 'production' ? 'production' : 'development',
    'browser',
    res.platformName,
    res.app_code
  )
})

if (process.env.NODE_ENV !== 'development') document.domain = 'b2bwings.com'

ReactDOM.render(
    <React.StrictMode>
        <App />
    </React.StrictMode>,
  document.getElementById('root')
)

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals()