asb_cloud_front/src/App.js

42 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-04-02 17:22:34 +05:00
import {
BrowserRouter as Router,
Switch,
Route
} from 'react-router-dom'
import { ConfigProvider } from 'antd'
import locale from 'antd/lib/locale/ru_RU'
2021-04-09 17:59:35 +05:00
import { OpenAPI } from './services/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'
2021-07-26 14:40:35 +05:00
//OpenAPI.BASE = 'http://localhost:3000'
OpenAPI.TOKEN = async () => getUserToken()
OpenAPI.HEADERS = {'Content-Type': 'application/json'}
2021-04-02 17:22:34 +05:00
export const App = () => (
<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