2021-07-28 16:15:52 +03:00
|
|
|
import React from 'react';
|
|
|
|
import {
|
|
|
|
BrowserRouter, Switch, Route, Redirect,
|
|
|
|
} from 'react-router-dom';
|
|
|
|
|
2021-09-14 10:30:37 +03:00
|
|
|
import { isAuthenticated } from '../../client/state/auth';
|
2021-07-28 16:15:52 +03:00
|
|
|
|
|
|
|
import Auth from '../templates/auth/Auth';
|
|
|
|
import Client from '../templates/client/Client';
|
|
|
|
|
|
|
|
function App() {
|
|
|
|
return (
|
|
|
|
<BrowserRouter>
|
|
|
|
<Switch>
|
|
|
|
<Route exact path="/">
|
2021-09-14 10:30:37 +03:00
|
|
|
{ isAuthenticated() ? <Client /> : <Redirect to="/login" />}
|
2021-07-28 16:15:52 +03:00
|
|
|
</Route>
|
|
|
|
<Route path="/login">
|
2021-09-14 10:30:37 +03:00
|
|
|
{ isAuthenticated() ? <Redirect to="/" /> : <Auth type="login" />}
|
2021-07-28 16:15:52 +03:00
|
|
|
</Route>
|
|
|
|
<Route path="/register">
|
2021-09-14 10:30:37 +03:00
|
|
|
{ isAuthenticated() ? <Redirect to="/" /> : <Auth type="register" />}
|
2021-07-28 16:15:52 +03:00
|
|
|
</Route>
|
|
|
|
</Switch>
|
|
|
|
</BrowserRouter>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|