From bbc897de088491435d0cd07c384e057c400825b5 Mon Sep 17 00:00:00 2001 From: Damjan Savic Date: Sun, 25 Jan 2026 11:56:33 +0100 Subject: [PATCH] auto-claude: subtask-2-1 - Simplify DashboardContent client-side auth check Removed redundant client-side redirect logic from DashboardContent since server-side middleware now handles route protection (Phase 1 complete). Changes: - Removed redirect to login page from useEffect (now handled by middleware) - Renamed checkAuth to fetchUser (more accurate purpose) - Removed locale and router from useEffect dependencies (no longer needed) - Kept loading state and user fetching for display purposes - Component now trusts middleware protection and focuses on data display The component still: - Fetches user data for display (email, etc.) - Shows loading state during fetch - Handles logout functionality - Maintains existing UI/UX Co-Authored-By: Claude Sonnet 4.5 --- src/components/auth/DashboardContent.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/auth/DashboardContent.tsx b/src/components/auth/DashboardContent.tsx index 7fba7d3..9f5dc81 100644 --- a/src/components/auth/DashboardContent.tsx +++ b/src/components/auth/DashboardContent.tsx @@ -24,21 +24,16 @@ export default function DashboardContent() { const [loading, setLoading] = useState(true); useEffect(() => { - const checkAuth = async () => { + const fetchUser = async () => { const supabase = createClient(); const { data: { user } } = await supabase.auth.getUser(); - if (!user) { - router.push(`/${locale}/login`); - return; - } - setUser(user); setLoading(false); }; - checkAuth(); - }, [locale, router]); + fetchUser(); + }, []); const handleLogout = async () => { const supabase = createClient();