修复退出登录路径
This commit is contained in:
parent
d3b03cecf2
commit
dee056a76a
@ -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",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -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,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user