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
32 lines
957 B
TypeScript
32 lines
957 B
TypeScript
const sendCodeOtp = async ({
|
|
nomor,
|
|
codeOtp,
|
|
newMessage,
|
|
}: {
|
|
nomor: string;
|
|
codeOtp?: string;
|
|
newMessage?: string;
|
|
}) => {
|
|
const msg = newMessage || `HIPMI - Kode ini bersifat RAHASIA dan JANGAN DI BAGIKAN KEPADA SIAPAPUN, termasuk anggota ataupun pengurus HIPMI lainnya.\n\n>> Kode OTP anda: ${codeOtp}.`;
|
|
const enCode = encodeURIComponent(msg);
|
|
const res = await fetch(
|
|
`https://cld-dkr-prod-wajs-server.wibudev.com/api/wa/code?nom=${nomor}&text=${enCode}`,
|
|
{
|
|
cache: "no-cache",
|
|
headers: {
|
|
Authorization: `Bearer ${process.env.WA_SERVER_TOKEN}`,
|
|
},
|
|
},
|
|
);
|
|
// 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}.
|
|
// `,
|
|
// );
|
|
|
|
return res;
|
|
};
|
|
|
|
export { sendCodeOtp as funSendToWhatsApp };
|