mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 06:09:08 +03:00
* Change the destinations for next auth routes. * Change the folder definition to /auth. * Fix wrong docs. * More fixes. * Fix the redirect url to include the base path. * Minor fixes to the other auth blocks. * Fix example URLs. Remove some extra code. * Minor fixes for the avatar stack demo. * More fixes.
20 lines
566 B
TypeScript
20 lines
566 B
TypeScript
import { LogoutButton } from '@/registry/default/blocks/password-based-auth-nextjs/components/logout-button'
|
|
import { createClient } from '@/registry/default/clients/nextjs/lib/supabase/server'
|
|
import { redirect } from 'next/navigation'
|
|
|
|
export default async function ProtectedPage() {
|
|
const supabase = await createClient()
|
|
|
|
const { data, error } = await supabase.auth.getUser()
|
|
if (error || !data?.user) {
|
|
redirect('/example/password-based-auth/auth/login')
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<p>Hello {data.user.email}</p>
|
|
<LogoutButton />
|
|
</>
|
|
)
|
|
}
|