修复退出登录路径

This commit is contained in:
feie9456 2026-04-17 13:04:17 +08:00
parent d3b03cecf2
commit dee056a76a
2 changed files with 9 additions and 3 deletions

View File

@ -2,10 +2,13 @@ import { NextResponse } from "next/server";
import { clearCurrentCaregiverSession } from "@/lib/session"; import { clearCurrentCaregiverSession } from "@/lib/session";
export async function POST(request: Request) { export async function POST() {
await clearCurrentCaregiverSession(); await clearCurrentCaregiverSession();
return NextResponse.redirect(new URL("/login", request.url), { return new NextResponse(null, {
status: 303, status: 303,
headers: {
Location: "/login",
},
}); });
} }

View File

@ -13,7 +13,10 @@ export async function GET(request: NextRequest) {
const caregiver = await getCaregiverSession(); const caregiver = await getCaregiverSession();
const location = caregiver ? redirectTo : buildCaregiverLoginPath(redirectTo); const location = caregiver ? redirectTo : buildCaregiverLoginPath(redirectTo);
return NextResponse.redirect(new URL(location, request.url), { return new NextResponse(null, {
status: 307, status: 307,
headers: {
Location: location,
},
}); });
} }