mirror of
https://git.coastit.co.za/caitlin/CRM_ENVR.git
synced 2026-07-15 13:37:05 +02:00
Fixed the login again?
This commit is contained in:
@@ -1,22 +1,19 @@
|
||||
import { NextResponse } from "next/server"
|
||||
import { SESSION_COOKIE } from "@/lib/auth"
|
||||
|
||||
export async function POST() {
|
||||
try {
|
||||
const response = NextResponse.json({ success: true }, { status: 200 })
|
||||
response.cookies.set(SESSION_COOKIE, "", {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
sameSite: "strict",
|
||||
path: "/",
|
||||
maxAge: 0,
|
||||
return new Response(JSON.stringify({ success: true }), {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Set-Cookie": `${SESSION_COOKIE}=; HttpOnly; SameSite=Strict; Path=/; Max-Age=0`,
|
||||
},
|
||||
})
|
||||
return response
|
||||
} catch (error) {
|
||||
console.error("Logout error:", error)
|
||||
return NextResponse.json(
|
||||
{ error: "Logout failed." },
|
||||
{ status: 500 }
|
||||
return new Response(
|
||||
JSON.stringify({ error: "Logout failed." }),
|
||||
{ status: 500, headers: { "Content-Type": "application/json" } }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user