fix: sonarcloud warning and code cleanup

This commit is contained in:
canove
2021-01-15 07:04:01 -03:00
parent 454fd6ce08
commit a0e6b7b2c7
11 changed files with 40 additions and 45 deletions

View File

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