forked from ddrilling/asb_cloud_front
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
import {
|
|
BrowserRouter as Router,
|
|
Switch,
|
|
Route
|
|
} from 'react-router-dom'
|
|
import { ConfigProvider } from 'antd'
|
|
import locale from 'antd/lib/locale/ru_RU'
|
|
|
|
import { OpenAPI } from '@api'
|
|
import { getUserToken } from '@utils/storage'
|
|
import { PrivateRoute } from '@components/Private'
|
|
|
|
import Main from '@pages/Main'
|
|
import Login from '@pages/Login'
|
|
import Register from '@pages/Register'
|
|
|
|
import '@styles/App.less'
|
|
import { memo } from 'react'
|
|
|
|
//OpenAPI.BASE = 'http://localhost:3000'
|
|
OpenAPI.TOKEN = async () => getUserToken()
|
|
OpenAPI.HEADERS = {'Content-Type': 'application/json'}
|
|
|
|
export const App = memo(() => (
|
|
<ConfigProvider locale={locale}>
|
|
<Router>
|
|
<Switch>
|
|
<Route path={'/login'}>
|
|
<Login />
|
|
</Route>
|
|
<Route path={'/register'}>
|
|
<Register />
|
|
</Route>
|
|
<PrivateRoute path={'/'}>
|
|
<Main />
|
|
</PrivateRoute>
|
|
</Switch>
|
|
</Router>
|
|
</ConfigProvider>
|
|
))
|
|
|
|
export default App
|