新增设置页

This commit is contained in:
2026-04-17 14:26:28 +08:00
parent 2cf1fae21d
commit 6a65d956a8
9 changed files with 340 additions and 39 deletions
+31
View File
@@ -0,0 +1,31 @@
import { NextResponse } from "next/server";
import { sendCaregiverTestPush } from "@/lib/push";
import { getCaregiverDisplayName, getCaregiverSession } from "@/lib/session";
export async function POST() {
const caregiver = await getCaregiverSession();
if (!caregiver) {
return NextResponse.json({ error: "请先登录。" }, { status: 401 });
}
try {
const result = await sendCaregiverTestPush({
caregiverId: caregiver.id,
caregiverLabel: getCaregiverDisplayName(caregiver),
});
return NextResponse.json({
ok: true,
...result,
});
} catch (error) {
return NextResponse.json(
{
error: error instanceof Error ? error.message : "测试推送发送失败。",
},
{ status: 400 },
);
}
}