feat: tambah dependensi 'jose' versi 5.9.2 pada package.json
refactor: rapikan identasi dan buat field 'expires' opsional di model UserSession pada schema prisma chore: bersihkan import tidak terpakai di route login dan register API
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import { PwdCookies } from "@/app/lib";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ServerEnv } from "@/app/lib/server_env";
|
||||
import { sealData } from "iron-session";
|
||||
import { cookies } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
@@ -16,8 +15,6 @@ export async function POST(req: Request) {
|
||||
},
|
||||
});
|
||||
|
||||
myConsole(cekUsername);
|
||||
|
||||
if (cekUsername)
|
||||
return NextResponse.json({ status: 400, message: "Username sudah ada" });
|
||||
|
||||
@@ -35,7 +32,7 @@ export async function POST(req: Request) {
|
||||
username: data.username,
|
||||
}),
|
||||
{
|
||||
password: PwdCookies,
|
||||
password: ServerEnv.value?.WIBU_PWD as string,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import { PwdCookies } from "@/app/lib";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ServerEnv } from "@/app/lib/server_env";
|
||||
import { sealData } from "iron-session";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { cookies } from "next/headers";
|
||||
@@ -22,8 +21,6 @@ export async function POST(req: Request) {
|
||||
},
|
||||
});
|
||||
|
||||
myConsole(data);
|
||||
|
||||
if (!data) return NextResponse.json({ status: 404 });
|
||||
|
||||
if (data) {
|
||||
@@ -33,7 +30,7 @@ export async function POST(req: Request) {
|
||||
username: data.username,
|
||||
}),
|
||||
{
|
||||
password: await PwdCookies,
|
||||
password: ServerEnv.value?.WIBU_PWD as string,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
19
src/app/api/check-cookies/route.ts
Normal file
19
src/app/api/check-cookies/route.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import _ from "lodash";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export async function GET(req: Request) {
|
||||
try {
|
||||
const cekCookies = cookies();
|
||||
const c = cekCookies.get("ssn");
|
||||
|
||||
if (!c || !c?.value || _.isEmpty(c?.value) || _.isUndefined(c?.value)) {
|
||||
return Response.json({ success: false });
|
||||
}
|
||||
|
||||
return Response.json({ success: true });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
return Response.json({ success: false });
|
||||
}
|
||||
Reference in New Issue
Block a user