From 494d01aeed6b645822909c0ca8a902437ffbbf66 Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Sun, 14 Sep 2025 14:05:43 -0700 Subject: [PATCH] RequireAuth redirect when no jwt --- frontend/src/router.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/router.tsx b/frontend/src/router.tsx index 1284790e8..b06294a4c 100644 --- a/frontend/src/router.tsx +++ b/frontend/src/router.tsx @@ -3,7 +3,14 @@ import { LOGIN_TOKENS, useAuth, useUser } from "@lib/hooks"; import UpdatePage from "@pages/update"; import { Loader2 } from "lucide-react"; import { lazy, Suspense } from "react"; -import { BrowserRouter, Navigate, Outlet, Route, Routes, useLocation } from "react-router-dom"; +import { + BrowserRouter, + Navigate, + Outlet, + Route, + Routes, + useLocation, +} from "react-router-dom"; // Lazy import pages const Resources = lazy(() => import("@pages/resources")); @@ -128,7 +135,7 @@ const RequireAuth = () => { const { data: user, error } = useUser(); const location = useLocation(); - if (error) { + if (!LOGIN_TOKENS.jwt() || error) { if (location.pathname === "/") { return ; } @@ -148,5 +155,3 @@ const RequireAuth = () => { return ; }; - -