2021-04-02 17:22:34 +05:00
|
|
|
import {
|
|
|
|
BrowserRouter as Router,
|
|
|
|
Switch,
|
2022-01-12 20:49:30 +05:00
|
|
|
Route
|
|
|
|
} from 'react-router-dom'
|
2022-04-29 18:38:49 +05:00
|
|
|
import { memo } from 'react'
|
2022-01-12 20:49:30 +05:00
|
|
|
import { ConfigProvider } from 'antd'
|
|
|
|
import locale from 'antd/lib/locale/ru_RU'
|
|
|
|
|
2022-02-25 11:39:06 +05:00
|
|
|
import { PrivateRoute } from '@components/Private'
|
2022-04-29 18:38:49 +05:00
|
|
|
import { getUserToken } from '@utils/storage'
|
|
|
|
import { OpenAPI } from '@api'
|
2021-03-31 15:54:02 +05:00
|
|
|
|
2022-02-25 11:39:06 +05:00
|
|
|
import Main from '@pages/Main'
|
|
|
|
import Login from '@pages/Login'
|
|
|
|
import Register from '@pages/Register'
|
2022-01-12 20:49:30 +05:00
|
|
|
|
2022-02-25 11:39:06 +05:00
|
|
|
import '@styles/App.less'
|
2022-01-12 20:49:30 +05:00
|
|
|
|
2021-07-26 14:40:35 +05:00
|
|
|
//OpenAPI.BASE = 'http://localhost:3000'
|
2022-04-29 18:38:49 +05:00
|
|
|
OpenAPI.TOKEN = async () => getUserToken() ?? ''
|
2021-12-02 15:12:22 +05:00
|
|
|
OpenAPI.HEADERS = {'Content-Type': 'application/json'}
|
2021-04-02 17:22:34 +05:00
|
|
|
|
2022-02-25 16:57:08 +05:00
|
|
|
export const App = memo(() => (
|
2021-08-17 13:01:13 +05:00
|
|
|
<ConfigProvider locale={locale}>
|
2022-01-12 20:49:30 +05:00
|
|
|
<Router>
|
|
|
|
<Switch>
|
|
|
|
<Route path={'/login'}>
|
|
|
|
<Login />
|
|
|
|
</Route>
|
|
|
|
<Route path={'/register'}>
|
|
|
|
<Register />
|
|
|
|
</Route>
|
|
|
|
<PrivateRoute path={'/'}>
|
|
|
|
<Main />
|
|
|
|
</PrivateRoute>
|
|
|
|
</Switch>
|
|
|
|
</Router>
|
2021-08-17 13:01:13 +05:00
|
|
|
</ConfigProvider>
|
2022-02-25 16:57:08 +05:00
|
|
|
))
|
2022-01-12 20:49:30 +05:00
|
|
|
|
|
|
|
export default App
|