2021-05-26 13:35:57 +03:00
|
|
|
import React, { Suspense, lazy } from 'react'
|
|
|
|
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
|
|
|
|
import 'bootstrap/dist/css/bootstrap.min.css'
|
2021-05-25 14:50:01 +03:00
|
|
|
|
2021-05-26 13:35:57 +03:00
|
|
|
const AuthPage = lazy(() => import('./pages/AuthPage'))
|
|
|
|
const HomePage = lazy(() => import('./pages/HomePage'))
|
|
|
|
const CandidatePage = lazy(() => import('./pages/CandidatePage'))
|
|
|
|
|
|
|
|
const App = () => {
|
|
|
|
const isAuth = true
|
2021-05-25 14:50:01 +03:00
|
|
|
return (
|
2021-05-26 13:35:57 +03:00
|
|
|
<Router>
|
|
|
|
<Suspense fallback={<div>Loading...</div>}>
|
|
|
|
{isAuth ? (
|
|
|
|
<Switch>
|
|
|
|
<Route path="/" exact component={HomePage} />
|
|
|
|
<Route path="/candidate/:id" component={CandidatePage} />
|
|
|
|
<Route compoent={<div>Not found page</div>} />
|
|
|
|
</Switch>
|
|
|
|
) : (
|
|
|
|
<Route path="/" exact component={AuthPage} />
|
|
|
|
)}
|
|
|
|
</Suspense>
|
|
|
|
</Router>
|
|
|
|
)
|
2021-05-25 14:50:01 +03:00
|
|
|
}
|
|
|
|
|
2021-05-26 13:35:57 +03:00
|
|
|
export default App
|