Fix home page redirect for unauthenticated users

- Check session before calling getLists()
- Redirect to login page if not authenticated
- Prevents server component render error in production
This commit is contained in:
2025-12-02 12:40:15 +00:00
parent c51bc28d67
commit 92401c5324

View File

@@ -5,12 +5,19 @@ import GlobalSearch from '@/components/GlobalSearch'
import EmptyState from '@/components/EmptyState'
import Link from 'next/link'
import { auth } from '@/auth'
import { redirect } from 'next/navigation'
export const dynamic = 'force-dynamic'
export default async function Home() {
const lists = await getLists()
const session = await auth()
// Redirect to login if not authenticated
if (!session?.user) {
redirect('/auth/login')
}
const lists = await getLists()
return (
<main className="container mx-auto px-4 sm:px-6 py-6 sm:py-8 max-w-7xl">