diff --git a/src/layouts/PrivateRoute.tsx b/src/layouts/PrivateRoute.tsx index e75de219..4ca71872 100644 --- a/src/layouts/PrivateRoute.tsx +++ b/src/layouts/PrivateRoute.tsx @@ -1,46 +1,13 @@ -import React, { FC } from "react"; -import { Navigate, Outlet, useLocation } from "react-router-dom"; +import React from "react"; +import { Navigate, Outlet } from "react-router-dom"; import { selectIsAuthenticated } from "../store/auth/authSelectors"; import { useAppSelector } from "../store/store"; -// Router and Switch are needed Breaks site if not in import. DW - -// export function PrivateRoute({ component: Component, path, ...rest }) { -// const isAuthenticated = useAppSelector(state => !isRefreshTokenExpired(state)); -// return ( -// -// isAuthenticated ? ( -// -// ) : ( -// -// ) -// } -// /> -// ); -// } - -interface IProtectedRoute { - children: JSX.Element[]; -} - export function ProtectedRoute() { const isAuth = useAppSelector(selectIsAuthenticated); - const location = useLocation(); if (!isAuth) { - console.info(Date.now(), "ProtectedRoute.isAuth: ", isAuth); - // Redirect them to the /login page, but save the current location they were - // trying to go to when they were redirected. This allows us to send them - // along to that page after they login, which is a nicer user experience - // than dropping them off on the home page. return ; } diff --git a/src/layouts/login/LoginPage.tsx b/src/layouts/login/LoginPage.tsx index dec3465e..da364a80 100644 --- a/src/layouts/login/LoginPage.tsx +++ b/src/layouts/login/LoginPage.tsx @@ -14,7 +14,7 @@ import { useForm } from "@mantine/form"; import type { FormEvent } from "react"; import React, { useEffect } from "react"; import { useTranslation } from "react-i18next"; -import { Navigate, useLocation, useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import { Lock, User } from "tabler-icons-react"; import { fetchSiteSettings } from "../../actions/utilActions"; @@ -29,7 +29,6 @@ export function LoginPage(): JSX.Element { const isAuth = useAppSelector(selectIsAuthenticated); const { colorScheme } = useMantineColorScheme(); const dark = colorScheme === "dark"; - const location = useLocation(); const dispatch = useAppDispatch(); const { t } = useTranslation(); @@ -93,6 +92,7 @@ export function LoginPage(): JSX.Element { icon={} placeholder={t("login.usernameplaceholder")} name="username" + /* eslint-disable-next-line react/jsx-props-no-spreading */ {...form.getInputProps("username")} /> } placeholder={t("login.passwordplaceholder")} name="password" + /* eslint-disable-next-line react/jsx-props-no-spreading */ {...form.getInputProps("password")} />