16 lines
380 B
TypeScript
16 lines
380 B
TypeScript
import { NextResponse } from "next/server"
|
|
import { destroySession } from "@/lib/auth"
|
|
|
|
export async function POST() {
|
|
try {
|
|
await destroySession()
|
|
return NextResponse.json({ success: true }, { status: 200 })
|
|
} catch (error) {
|
|
console.error("Logout error:", error)
|
|
return NextResponse.json(
|
|
{ error: "Logout failed." },
|
|
{ status: 500 }
|
|
)
|
|
}
|
|
}
|