- supabase 선언할 때 주의
import { redirect } from 'next/navigation'
import { createClient } from '@/utils/supabase/server'
export default async function PrivatePage() {
const supabase = await createClient()
const { data, error } = await supabase.auth.getUser()
if (error || !data?.user) {
redirect('/login')
}
return (
<div className='w-full h-screen flex justify-center items-center'>
<p>Hello {data.user.email}</p>
</div>
)
}
위와 같이 supabase 선언할 떄 createClient 앞에 await를 붙여주자