Fix API Login dan filter 0 di input nomor

### No Issue
This commit is contained in:
2025-12-17 11:40:01 +08:00
parent c50e0ceaf7
commit a72cf866fa
3 changed files with 60 additions and 22 deletions

View File

@@ -33,18 +33,24 @@ export async function POST(req: Request) {
// const encodedMsg = encodeURIComponent(msg);
const res = await fetch(
`https://wa.wibudev.com/code?nom=${nomor}&text=${msg}`,
{ cache: "no-cache" }
`https://cld-dkr-prod-wajs-server.wibudev.com/api/wa/code?nom=${nomor}&text=${msg}`,
{
cache: "no-cache",
headers: {
Authorization: `Bearer ${process.env.WA_SERVER_TOKEN}`,
},
}
);
const sendWa = await res.json();
if (sendWa.status !== "success")
if (res.status !== 200)
return NextResponse.json(
{ success: false, message: "Nomor Whatsapp Tidak Aktif" },
{ status: 400 }
);
const sendWa = await res.text();
console.log("WA Response:", sendWa);
return NextResponse.json(
{
success: true,
@@ -63,5 +69,5 @@ export async function POST(req: Request) {
},
{ status: 500 }
);
}
}
}