mirror of
https://github.com/cinnyapp/cinny.git
synced 2024-11-20 14:59:55 +01:00
commit
14cfa69060
2 changed files with 6 additions and 6 deletions
|
@ -3,7 +3,7 @@ import {
|
|||
BrowserRouter, Switch, Route, Redirect,
|
||||
} from 'react-router-dom';
|
||||
|
||||
import { isAuthanticated } from '../../client/state/auth';
|
||||
import { isAuthenticated } from '../../client/state/auth';
|
||||
|
||||
import Auth from '../templates/auth/Auth';
|
||||
import Client from '../templates/client/Client';
|
||||
|
@ -13,13 +13,13 @@ function App() {
|
|||
<BrowserRouter>
|
||||
<Switch>
|
||||
<Route exact path="/">
|
||||
{ isAuthanticated() ? <Client /> : <Redirect to="/login" />}
|
||||
{ isAuthenticated() ? <Client /> : <Redirect to="/login" />}
|
||||
</Route>
|
||||
<Route path="/login">
|
||||
{ isAuthanticated() ? <Redirect to="/" /> : <Auth type="login" />}
|
||||
{ isAuthenticated() ? <Redirect to="/" /> : <Auth type="login" />}
|
||||
</Route>
|
||||
<Route path="/register">
|
||||
{ isAuthanticated() ? <Redirect to="/" /> : <Auth type="register" />}
|
||||
{ isAuthenticated() ? <Redirect to="/" /> : <Auth type="register" />}
|
||||
</Route>
|
||||
</Switch>
|
||||
</BrowserRouter>
|
||||
|
|
|
@ -4,7 +4,7 @@ function getSecret(key) {
|
|||
return localStorage.getItem(key);
|
||||
}
|
||||
|
||||
const isAuthanticated = () => getSecret(cons.secretKey.ACCESS_TOKEN) !== null;
|
||||
const isAuthenticated = () => getSecret(cons.secretKey.ACCESS_TOKEN) !== null;
|
||||
|
||||
const secret = {
|
||||
accessToken: getSecret(cons.secretKey.ACCESS_TOKEN),
|
||||
|
@ -14,6 +14,6 @@ const secret = {
|
|||
};
|
||||
|
||||
export {
|
||||
isAuthanticated,
|
||||
isAuthenticated,
|
||||
secret,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue