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

@@ -18,11 +18,11 @@ export async function POST(req: Request) {
const sendWa = await res.json();
if (sendWa.status !== "success")
return new Response(
JSON.stringify({
return NextResponse.json(
{
success: false,
message: "Nomor Whatsapp Tidak Aktif",
}),
},
{ status: 400 }
);
@@ -34,32 +34,36 @@ export async function POST(req: Request) {
});
if (!createOtpId)
return new Response(
JSON.stringify({
return NextResponse.json(
{
success: false,
message: "Gagal Membuat Kode OTP",
}),
},
{ status: 400 }
);
return new Response(
JSON.stringify({
return NextResponse.json(
{
success: true,
message: "Kode Verifikasi Dikirim",
kodeId: createOtpId.id,
}),
},
{ status: 200 }
);
} catch (error) {
console.log(error);
return new Response(
JSON.stringify({
return NextResponse.json(
{
success: false,
message: "Server Whatsapp Error !!",
}),
},
{ status: 500 }
);
}
}
return NextResponse.json({ success: false });
return NextResponse.json(
{ success: false, message: "Method Not Allowed" },
{ status: 405 }
);
}