From f6ac9c9bbaccf911c6997f09e8cca7e4525cb54c Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 21 May 2025 19:21:41 +0800 Subject: [PATCH] . --- chatdesk-ui/app/api/clearcookies/route.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/chatdesk-ui/app/api/clearcookies/route.js b/chatdesk-ui/app/api/clearcookies/route.js index 5323996..01d531a 100644 --- a/chatdesk-ui/app/api/clearcookies/route.js +++ b/chatdesk-ui/app/api/clearcookies/route.js @@ -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 }); } }