layout responsivo 2ª parte

This commit is contained in:
ertprs
2021-09-07 13:00:51 -03:00
parent 50d6c42345
commit 4bf8ac4521
15 changed files with 2108 additions and 1951 deletions

View File

@@ -5,32 +5,32 @@ import { AuthContext } from "../context/Auth/AuthContext";
import BackdropLoading from "../components/BackdropLoading";
const Route = ({ component: Component, isPrivate = false, ...rest }) => {
const { isAuth, loading } = useContext(AuthContext);
const { isAuth, loading } = useContext(AuthContext);
if (!isAuth && isPrivate) {
return (
<>
{loading && <BackdropLoading />}
<Redirect to={{ pathname: "/login", state: { from: rest.location } }} />
</>
);
}
if (!isAuth && isPrivate) {
return (
<>
{loading && <BackdropLoading />}
<Redirect to={{ pathname: "/login", state: { from: rest.location } }} />
</>
);
}
if (isAuth && !isPrivate) {
return (
<>
{loading && <BackdropLoading />}
<Redirect to={{ pathname: "/", state: { from: rest.location } }} />;
</>
);
}
if (isAuth && !isPrivate) {
return (
<>
{loading && <BackdropLoading />}
<Redirect to={{ pathname: "/", state: { from: rest.location } }} />;
</>
);
}
return (
<>
{loading && <BackdropLoading />}
<RouterRoute {...rest} component={Component} />
</>
);
return (
<>
{loading && <BackdropLoading />}
<RouterRoute {...rest} component={Component} />
</>
);
};
export default Route;