23 lines
603 B
TypeScript
23 lines
603 B
TypeScript
import { createClient } from '@/lib/supabase/server'
|
|
import { HomeClient } from '@/components/HomeClient'
|
|
import { isSetupNeeded } from '@/lib/actions/setup'
|
|
import { redirect } from 'next/navigation'
|
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
export default async function Home() {
|
|
if (await isSetupNeeded()) {
|
|
redirect('/setup')
|
|
}
|
|
|
|
let user = null
|
|
try {
|
|
const supabase = await createClient()
|
|
const { data } = await supabase.auth.getUser()
|
|
user = data.user
|
|
} catch (e) {
|
|
console.error("Failed to fetch user in page.tsx:", e)
|
|
}
|
|
|
|
return <HomeClient initialUser={user} />
|
|
} |