import React from 'react'
import { ConfigProvider } from 'antd'
import { Router, Route, Switch } from 'dva/router'
import MainLayout from './layout/Main'
import Login from './routes/Login'
import Home from './routes/Home'
import Main from './routes/Main'
import Backend from './routes/Backend'
import HomeMobileNew from './routes/HomeMobileNew'
import { $consts } from './plugins'
import zhCN from 'antd/lib/locale-provider/zh_CN'
import 'moment/src/locale/zh-cn'

function RouterConfig ({ history }) {
  return (
    <Router history={history}>
      <ConfigProvider locale={zhCN}>
        <MainLayout>
          <Switch>
            <Route path={$consts['ROUTE/LOGIN']} component={Login} />
            <Route path={$consts['ROUTE/HOME']} component={Home} />
            <Route path={$consts['ROUTE/MAIN']} component={Main} />
            <Route path={$consts['ROUTE/BACKEND']} component={Backend} />
            {/* <Route path={$consts['ROUTE/HomeMobileNew']} component={HomeMobileNew} /> */}
          </Switch>
        </MainLayout>
      </ConfigProvider>
    </Router>
  )
}

export default RouterConfig
