Skip to content
Snippets Groups Projects

Polished auth flow including ReservedRoute and role selection.

Merged Defendi Alberto requested to merge feature/privateroute/role into dev
1 file
+ 8
4
Compare changes
  • Side-by-side
  • Inline
@@ -24,11 +24,15 @@ export const RestrictedRoute = ({ Component, path }: Props): JSX.Element => {
const [isLoading, setLoading] = useState<boolean>(false);
useEffect(() => {
isAuthenticated().then((res) => setIsAuth(res));
console.log(isAuth);
}, [isAuth]);
isAuthenticated().then((res) => {
setIsAuth(res);
setLoading(true);
});
}, [isAuth, setLoading]);
return (
return !isLoading ? (
<CircularProgress />
) : (
<Route
path={path}
render={(props: RouteProps) =>
Loading