import React, { useContext } from "react";
import { Route as RouterRoute, Redirect } from "react-router-dom";
import { AuthContext } from "../context/Auth/AuthContext";
import BackdropLoading from "../components/BackdropLoading";
const Route = ({ component: Component, isPrivate = false, ...rest }) => {
const { isAuth, loading } = useContext(AuthContext);
if (!isAuth && isPrivate) {
return (
<>
{loading && }
>
);
}
if (isAuth && !isPrivate) {
return (
<>
{loading && }
;
>
);
}
return (
<>
{loading && }
>
);
};
export default Route;