Fix redirect on SSO login (#142), #27, #94

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2021-10-19 19:38:09 +05:30
parent 76c3660cb2
commit 977759145e
2 changed files with 14 additions and 20 deletions

View file

@ -1,6 +1,6 @@
import React from 'react';
import {
BrowserRouter, Switch, Route, Redirect,
BrowserRouter,
} from 'react-router-dom';
import { isAuthenticated } from '../../client/state/auth';
@ -11,17 +11,7 @@ import Client from '../templates/client/Client';
function App() {
return (
<BrowserRouter>
<Switch>
<Route exact path="/">
{ isAuthenticated() ? <Client /> : <Redirect to="/login" />}
</Route>
<Route path="/login">
{ isAuthenticated() ? <Redirect to="/" /> : <Auth type="login" />}
</Route>
<Route path="/register">
{ isAuthenticated() ? <Redirect to="/" /> : <Auth type="register" />}
</Route>
</Switch>
{ isAuthenticated() ? <Client /> : <Auth />}
</BrowserRouter>
);
}