title: auto
des: auto note:auto
This commit is contained in:
@@ -6,8 +6,11 @@ import { NextResponse } from "next/server";
|
||||
import { cookies } from "next/headers";
|
||||
import { getConfig } from "@/bin/config";
|
||||
|
||||
export async function POST(req: Request) {
|
||||
import fs from "fs";
|
||||
import yaml from "yaml";
|
||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||
|
||||
export async function POST(req: Request) {
|
||||
if (req.method === "POST") {
|
||||
const body = await req.json();
|
||||
// MyConsole(body);
|
||||
@@ -37,7 +40,7 @@ export async function POST(req: Request) {
|
||||
username: data.username,
|
||||
}),
|
||||
{
|
||||
password: (await getConfig()).server.password,
|
||||
password: await config.server.password,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -4,11 +4,15 @@ import { NextResponse } from "next/server";
|
||||
import { cookies } from "next/headers";
|
||||
import { sealData, unsealData } from "iron-session";
|
||||
import { getConfig } from "@/bin/config";
|
||||
import yaml from "yaml";
|
||||
import fs from "fs";
|
||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||
|
||||
export async function POST(req: Request) {
|
||||
|
||||
if (req.method === "POST") {
|
||||
const body = await req.json();
|
||||
myConsole(body);
|
||||
|
||||
|
||||
const data = await prisma.user.findUnique({
|
||||
where: {
|
||||
@@ -22,6 +26,8 @@ export async function POST(req: Request) {
|
||||
},
|
||||
});
|
||||
|
||||
myConsole(data)
|
||||
|
||||
if (!data) return NextResponse.json({ status: 404 });
|
||||
|
||||
if (data) {
|
||||
@@ -31,15 +37,10 @@ export async function POST(req: Request) {
|
||||
username: data.username,
|
||||
}),
|
||||
{
|
||||
password: (await getConfig()).server.password,
|
||||
password: (await config.server.password),
|
||||
}
|
||||
);
|
||||
|
||||
const un = await unsealData(res, {
|
||||
password: (await getConfig()).server.password,
|
||||
});
|
||||
// console.log(JSON.stringify(un), "route validasi")
|
||||
|
||||
cookies().set({
|
||||
name: "ssn",
|
||||
value: res,
|
||||
|
||||
Reference in New Issue
Block a user