Fix: middleware
Deskripsi - Fix middleware - Fix metode login ( sekarang menggunakan api )
This commit is contained in:
@@ -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" });
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user