Fix send whatsapp

Auth API
- src/app/api/auth/login/route.ts
- src/app/api/auth/mobile-login/route.ts
- src/app/api/auth/mobile-register/route.ts
- src/app/api/auth/resend/route.ts

User API (Mobile)
- src/app/api/mobile/user/route.ts
- src/app/api/mobile/admin/user/[id]/route.ts

Utility
- src/lib/code-otp-sender.ts

### No issue
This commit is contained in:
2026-01-29 15:04:40 +08:00
parent c94da645f3
commit 8b54f5ca65
7 changed files with 48 additions and 23 deletions

View File

@@ -1,4 +1,5 @@
import { prisma } from "@/lib";
import { funSendToWhatsApp } from "@/lib/code-otp-sender";
import _ from "lodash";
import { NextResponse } from "next/server";
@@ -50,8 +51,25 @@ async function PUT(request: Request, { params }: { params: { id: string } }) {
data: {
active: data.active,
},
select: {
nomor: true,
},
});
if (data.active) {
const resSendCode = await funSendToWhatsApp({
nomor: updateData.nomor,
newMessage:
"Halo sahabat HIConnect, \nSelamat akun anda telah aktif ! \n\n*Pesan ini di kirim secara otomatis, tidak perlu di balas.",
});
} else {
const resSendCode = await funSendToWhatsApp({
nomor: updateData.nomor,
newMessage:
"Halo sahabat HIConnect, \nMohon maaf akun anda telah dinonaktifkan ! Hubungi admin untuk informasi lebih lanjut. \n\n*Pesan ini di kirim secara otomatis, tidak perlu di balas.",
});
}
console.log("[Update Active Berhasil]", updateData);
} else if (category === "role") {
const fixName = _.startCase(data.role.replace(/_/g, " "));