mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
20 lines
528 B
TypeScript
20 lines
528 B
TypeScript
import { createClient } from '@/lib/supabase/server'
|
|
import { revalidatePath } from 'next/cache'
|
|
import { type NextRequest, NextResponse } from 'next/server'
|
|
|
|
export async function POST(req: NextRequest) {
|
|
const supabase = await createClient()
|
|
|
|
// Check if a user's logged in
|
|
const { data: claimsData } = await supabase.auth.getClaims()
|
|
|
|
if (claimsData?.claims) {
|
|
await supabase.auth.signOut()
|
|
}
|
|
|
|
revalidatePath('/', 'layout')
|
|
return NextResponse.redirect(new URL('/login', req.url), {
|
|
status: 302,
|
|
})
|
|
}
|