This commit is contained in:
hailin 2025-05-21 19:21:41 +08:00
parent 0c9c5770b5
commit f6ac9c9bba
1 changed files with 11 additions and 7 deletions

View File

@ -35,18 +35,22 @@
// app/api/clearcookies/route.js
export async function POST(req, res) {
import { NextResponse } from 'next/server';
export async function POST(req) {
try {
console.log("Clearing cookies...");
// 进行清除 cookie 的操作(逻辑代码)
// 假设你要清除 cookies 并且返回成功响应
// Perform cookie clearing logic here
return res.status(200).json({ message: "Cookies cleared successfully" });
// Return success response using NextResponse
return NextResponse.json({ message: "Cookies cleared successfully" }, { status: 200 });
} catch (error) {
console.error("Error occurred while clearing cookies:", error);
// 返回 500 错误响应
return res.status(500).json({ error: "Internal server error" });
// Return error response
return NextResponse.json({ error: "Internal server error" }, { status: 500 });
}
}