route.js 425 B

1234567891011121314151617
  1. // app/api/auth/logout/route.js
  2. import { NextResponse } from "next/server";
  3. export async function GET() {
  4. const response = NextResponse.json({ message: "Logout successful" });
  5. response.cookies.set("authToken", "", {
  6. path: "/",
  7. expires: new Date(0),
  8. httpOnly: true,
  9. secure: process.env.NODE_ENV === "production",
  10. });
  11. response.headers.set("Cache-Control", "no-store"); // Caching verhindern
  12. return response;
  13. }