2022-06-09 17:51:41 +05:00
|
|
|
import { BrowserRouter as Router, Navigate, Route, Routes } 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-06-09 17:51:41 +05:00
|
|
|
import { RootPathContext } from '@asb/context'
|
|
|
|
import { getUserToken, NoAccessComponent } from '@utils'
|
2022-04-29 18:38:49 +05:00
|
|
|
import { OpenAPI } from '@api'
|
2021-03-31 15:54:02 +05:00
|
|
|
|
2022-06-09 17:51:41 +05:00
|
|
|
import AdminPanel from '@pages/AdminPanel'
|
|
|
|
import Well from '@pages/Well'
|
2022-02-25 11:39:06 +05:00
|
|
|
import Login from '@pages/Login'
|
2022-06-09 17:51:41 +05:00
|
|
|
import Cluster from '@pages/Cluster'
|
|
|
|
import Deposit from '@pages/Deposit'
|
2022-02-25 11:39:06 +05:00
|
|
|
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-06-09 17:51:41 +05:00
|
|
|
<RootPathContext.Provider value={''}>
|
|
|
|
<Router>
|
|
|
|
<Routes>
|
|
|
|
<Route index element={<Navigate to={Deposit.getKey()} replace />} />
|
|
|
|
<Route path={'*'} element={<NoAccessComponent />} />
|
|
|
|
|
|
|
|
{/* Public pages */}
|
|
|
|
<Route path={Login.route} element={<Login />} />
|
|
|
|
<Route path={Register.route} element={<Register />} />
|
|
|
|
|
|
|
|
{/* Admin pages */}
|
|
|
|
<Route path={AdminPanel.route} element={<AdminPanel />} />
|
|
|
|
|
|
|
|
{/* User pages */}
|
|
|
|
<Route path={Deposit.route} element={<Deposit />} />
|
|
|
|
<Route path={Cluster.route} element={<Cluster />} />
|
|
|
|
<Route path={Well.route} element={<Well />} />
|
|
|
|
</Routes>
|
|
|
|
</Router>
|
|
|
|
</RootPathContext.Provider>
|
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
|