Fix event & auth

Deskripsi:
- Fix event kondisi user melewatkan event
- Fix bug force-dynamic di beberapa api
This commit is contained in:
2024-12-08 17:16:05 +08:00
parent 5eec7d57be
commit 231f713005
16 changed files with 121 additions and 167 deletions

View File

@@ -1,28 +1,21 @@
import { prisma } from "@/app/lib";
import { cookies } from "next/headers";
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const id = searchParams.get("id");
import { NextRequest, NextResponse } from "next/server";
export const dynamic = "force-dynamic";
export async function GET(request: NextRequest) {
const id = request.nextUrl.searchParams.get("id");
// const { searchParams } = new URL(request.url);
// const id = searchParams.get("id");
const delToken = await prisma.userSession.delete({
where: {
userId: id as string,
},
});
const delToken = await prisma.userSession.delete({
where: {
userId: id as string,
},
});
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" });
// }
return NextResponse.json(
{ success: true, message: "Logout Berhasil" },
{ status: 200 }
);
}