尝试增加管理页面

This commit is contained in:
sijinhui
2023-12-20 13:33:11 +08:00
parent ec3c324ef2
commit d37e5fb4ac
6 changed files with 161 additions and 116 deletions

View File

@@ -2,15 +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;
}
// function cleanObjectKeys(input: { [key: string]: string }): {
// [key: string]: string;
// } {
// const cleanedObj: { [key: string]: string } = {};
// Object.keys(input).forEach((key) => {
// cleanedObj[key] = input[key].trim();
// });
// console.log('========', input, cleanedObj)
// return cleanedObj;
// }
async function handle(
req: NextRequest,
@@ -23,7 +24,7 @@ async function handle(
}
// console.log("===========4", request_data);
await prisma.logEntry.create({
data: cleanObjectKeys(request_data),
data: request_data,
});
} catch (e) {
return NextResponse.json({ status: 0 });