asb_cloud_front/src/App.js

36 lines
933 B
JavaScript

import './styles/App.less'
import {
BrowserRouter as Router,
Switch,
Route} from "react-router-dom"
import {ConfigProvider} from 'antd'
import locale from "antd/lib/locale/ru_RU"
import Login from './pages/Login'
import Register from './pages/Register'
import Main from './pages/Main'
import { OpenAPI } from './services/api'
import { PrivateRoute } from './components/Private'
//OpenAPI.BASE = 'http://localhost:3000'
OpenAPI.TOKEN = localStorage['token']
OpenAPI.HEADERS = {'Content-Type': 'application/json'}
export default function App() {
return (
<ConfigProvider locale={locale}>
<Router>
<Switch>
<Route path={'/login'}>
<Login />
</Route>
<Route path={'/register'}>
<Register />
</Route>
<PrivateRoute path={'/'}>
<Main />
</PrivateRoute>
</Switch>
</Router>
</ConfigProvider>
);
}