title: auto

des: auto
note:auto
This commit is contained in:
2023-10-03 09:32:00 +08:00
parent 6ac6720c66
commit bde21823de
10 changed files with 37 additions and 9 deletions

View File

@@ -4,8 +4,10 @@ import prisma from "@/app/lib/prisma";
import { data } from "autoprefixer";
import { NextResponse } from "next/server";
import { cookies } from "next/headers";
import { getConfig } from "@/bin/config";
export async function POST(req: Request) {
if (req.method === "POST") {
const body = await req.json();
// MyConsole(body);
@@ -35,7 +37,7 @@ export async function POST(req: Request) {
username: data.username,
}),
{
password: process.env.PWD as string,
password: (await getConfig()).server.password,
}
);
@@ -45,8 +47,7 @@ export async function POST(req: Request) {
maxAge: 60 * 60 * 24 * 7,
});
return NextResponse.json({ status: 201});
return NextResponse.json({ status: 201 });
}
return NextResponse.json({ success: true });

View File

@@ -3,6 +3,7 @@ import prisma from "@/app/lib/prisma";
import { NextResponse } from "next/server";
import { cookies } from "next/headers";
import { sealData, unsealData } from "iron-session";
import {getConfig} from "@/bin/config";
export async function POST(req: Request) {
if (req.method === "POST") {
@@ -30,7 +31,7 @@ export async function POST(req: Request) {
username: data.username,
}),
{
password: process.env.PWD as string,
password: (await getConfig()).server.password,
}
);