还有遗留bug

This commit is contained in:
sijinhui
2023-12-19 23:44:20 +08:00
parent 8d83e8ad16
commit ec3c324ef2
4 changed files with 157 additions and 26 deletions

View File

@@ -2,6 +2,16 @@ import { NextRequest, NextResponse } from "next/server";
import prisma from "@/lib/prisma";
import { insertUser } from "@/lib/auth";
function cleanObjectKeys(input: { [key: string]: string }): {
[key: string]: string;
} {
const cleanedObj: { [key: string]: string } = {};
Object.keys(input).forEach((key) => {
cleanedObj[key] = input[key].trim();
});
return cleanedObj;
}
async function handle(
req: NextRequest,
{ params }: { params: { path: string[] } },
@@ -13,7 +23,7 @@ async function handle(
}
// console.log("===========4", request_data);
await prisma.logEntry.create({
data: request_data,
data: cleanObjectKeys(request_data),
});
} catch (e) {
return NextResponse.json({ status: 0 });