Fix: middleware

Deskripsi
- Fix middleware
- Fix metode login ( sekarang menggunakan api )
This commit is contained in:
2024-12-02 16:24:03 +08:00
parent 45279cd37f
commit 31124c5500
55 changed files with 1675 additions and 420 deletions

View File

@@ -1,12 +1,28 @@
import { prisma } from "@/app/lib";
import { cookies } from "next/headers";
import { NextResponse } from "next/server";
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const id = searchParams.get("id");
export async function GET() {
cookies().set({
name: "mySession",
value: "",
maxAge: 0,
});
const delToken = await prisma.userSession.delete({
where: {
userId: id as string,
},
});
return NextResponse.json({ status: 200, message: "Logout" });
const del = cookies().delete(process.env.NEXT_PUBLIC_BASE_SESSION_KEY!);
return new Response(JSON.stringify({ success: true, message: "Logout Berhasil" }), {status: 200});
}
// import { cookies } from "next/headers";
// import { NextResponse } from "next/server";
// export async function GET() {
// cookies().set({
// name: "mySession",
// value: "",
// maxAge: 0,
// });
// return NextResponse.json({ status: 200, message: "Logout" });
// }