delete file tamplate

This commit is contained in:
2025-02-05 11:49:09 +08:00
parent 0d515797f5
commit 331b5c9a84
36 changed files with 16 additions and 1110 deletions

View File

@@ -11,8 +11,7 @@ async function DELETE(request: Request) {
}
try {
// Ambil parameter nomor dari URL
const { searchParams } = new URL(request.url);
const nomor = searchParams.get("nomor");
const { nomor } = await request.json();
// Validasi parameter nomor
if (!nomor) {
@@ -27,6 +26,9 @@ async function DELETE(request: Request) {
// Cek apakah data OTP dengan nomor tersebut ada
const existingOtp = await prisma.kodeOtp.findFirst({
orderBy: {
createdAt: "desc",
},
where: { nomor },
});

View File

@@ -40,8 +40,12 @@ const apiDeleteAktivasiKodeOtpByNomor = async ({
}: {
nomor: string;
}) => {
const respone = await fetch(`/api/auth/delete/${nomor}`, {
const respone = await fetch(`/api/auth/code`, {
method: "DELETE",
body: JSON.stringify({nomor}),
headers: {
"Content-Type": "application/json",
}
});
return await respone.json().catch(() => null);

View File

@@ -129,6 +129,7 @@ export const middleware = async (req: NextRequest) => {
// ==================== Authentication: Login, Validasi, Registrasi ==================== //
// Token verification
const user = await verifyToken({ token, encodedKey });
console.log("middlaware",user)
// Handle login page access
if (pathname === loginPath) {