delete file tamplate
This commit is contained in:
@@ -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 },
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user