添加账号系统

This commit is contained in:
2026-04-17 12:58:38 +08:00
parent 032e207888
commit d3b03cecf2
27 changed files with 931 additions and 254 deletions
+10 -2
View File
@@ -1,7 +1,7 @@
import { NextResponse } from "next/server";
import { createFamilyMessageFromCaregiver } from "@/lib/monitor-data";
import { getOrCreateCaregiverSession } from "@/lib/session";
import { getCaregiverSession } from "@/lib/session";
export async function POST(request: Request) {
const body = (await request.json().catch(() => null)) as
@@ -27,7 +27,15 @@ export async function POST(request: Request) {
}
try {
const caregiver = await getOrCreateCaregiverSession();
const caregiver = await getCaregiverSession();
if (!caregiver) {
return NextResponse.json(
{ error: "请先登录账号后再发送留言。" },
{ status: 401 },
);
}
const message = await createFamilyMessageFromCaregiver({
caregiverId: caregiver.id,
rawDeviceValue: body.deviceUuid,