- Merubah kode dan menambah enCode untuk dikirim ke Whatsapp
- src/app/api/auth/login/route.ts & src/app/api/auth/resend/route.ts

### No Issue
This commit is contained in:
2025-11-17 11:29:54 +08:00
parent a49b95ac8e
commit 14fbd1a6dd
3 changed files with 42 additions and 11 deletions

View File

@@ -29,11 +29,12 @@ export async function POST(req: Request) {
{ status: 400 }
);
const msg = `HIPMI - Kode ini bersifat RAHASIA dan JANGAN DI BAGIKAN KEPADA SIAPAPUN, termasuk anggota ataupun pengurus HIPMI lainnya.\n\n>> Kode OTP anda: ${codeOtp}.`;
const encodedMsg = encodeURIComponent(msg);
const res = await fetch(
`https://wa.wibudev.com/code?nom=${nomor}&text=HIPMI - Kode ini bersifat RAHASIA dan JANGAN DI BAGIKAN KEPADA SIAPAPUN, termasuk anggota ataupun pengurus HIPMI lainnya.
\n
>> Kode OTP anda: ${codeOtp}.
`
`https://wa.wibudev.com/code?nom=${nomor}&text=${encodedMsg}`,
{ cache: "no-cache" }
);
const sendWa = await res.json();
@@ -62,7 +63,5 @@ export async function POST(req: Request) {
},
{ status: 500 }
);
} finally {
await prisma.$disconnect();
}
}
}

View File

@@ -16,14 +16,16 @@ export async function POST(req: Request) {
const body = await req.json();
const { nomor } = body;
const msg = `HIPMI - Kode ini bersifat RAHASIA dan JANGAN DI BAGIKAN KEPADA SIAPAPUN, termasuk anggota ataupun pengurus HIPMI lainnya.\n\n>> Kode OTP anda: ${codeOtp}.`;
const encodedMsg = encodeURIComponent(msg);
const res = await fetch(
`https://wa.wibudev.com/code?nom=${nomor}&text=HIPMI - Kode ini bersifat RAHASIA dan JANGAN DI BAGIKAN KEPADA SIAPAPUN, termasuk anggota ataupun pengurus HIPMI lainnya.
\n
>> Kode OTP anda: ${codeOtp}.
`
`https://wa.wibudev.com/code?nom=${nomor}&text=${encodedMsg}`,
{ cache: "no-cache" }
);
const sendWa = await res.json();
if (sendWa.status !== "success")
return NextResponse.json(
{