From 73a9787daff8c7f82e4f2df21a39d34823951db3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 11 Apr 2026 19:51:00 +0530 Subject: [PATCH] refactor: use proper config for routes --- frontend/src/components/RouteGuards.tsx | 2 +- frontend/src/pages/Login.tsx | 6 +----- frontend/src/pages/VerifyEmail.tsx | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/RouteGuards.tsx b/frontend/src/components/RouteGuards.tsx index d67a067..ff2b46f 100644 --- a/frontend/src/components/RouteGuards.tsx +++ b/frontend/src/components/RouteGuards.tsx @@ -15,7 +15,7 @@ export function ProtectedRoute({ children }: { children: React.ReactNode }) { if (!isAuthenticated) { // Save the intended location to redirect back after login - return ; + return ; } return <>{children}; diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx index 1ff4eab..a9aa38e 100644 --- a/frontend/src/pages/Login.tsx +++ b/frontend/src/pages/Login.tsx @@ -36,17 +36,13 @@ export default function Login() { setIsLoading(true); setApiError(null); try { - // 1. Authenticate const { data: authData } = await publicApi.post(endpoints.LOGIN, data); - // 2. Fetch User Profile with the fresh token - // We pass the header explicitly to avoid any race conditions with interceptors const { data: userData } = await api.get(endpoints.ME, { headers: { Authorization: `Bearer ${authData.access}` }, }); - // 3. Update store using the hook method - await login(authData.access, userData); + login(authData.access, userData); navigate(ROUTES.DRAWER); } catch (err) { diff --git a/frontend/src/pages/VerifyEmail.tsx b/frontend/src/pages/VerifyEmail.tsx index 52d1557..3c0c3be 100644 --- a/frontend/src/pages/VerifyEmail.tsx +++ b/frontend/src/pages/VerifyEmail.tsx @@ -33,7 +33,6 @@ export default function VerifyEmail() { type="button" className="text-xs italic opacity-40 cursor-pointer underline" onClick={() => window.close()} - onKeyDown={(e) => e.key === "Enter" && window.close()} > You can close this window now.