From c50e0ceaf7906445bd8ef77c6fc9aade9e0221ec Mon Sep 17 00:00:00 2001 From: bagasbanuna Date: Wed, 17 Dec 2025 11:07:15 +0800 Subject: [PATCH 1/2] chore(release): 1.5.27 --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 990816a3..dfe2d16a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. +## [1.5.27](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.26...v1.5.27) (2025-12-17) + ## [1.5.26](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.25...v1.5.26) (2025-12-10) ## [1.5.25](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.24...v1.5.25) (2025-12-09) diff --git a/package.json b/package.json index 93f91e41..481004a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hipmi", - "version": "1.5.26", + "version": "1.5.27", "private": true, "prisma": { "seed": "bun prisma/seed.ts" From a72cf866fa19fb8243ffedd18eda92b6d8176baa Mon Sep 17 00:00:00 2001 From: bagasbanuna Date: Wed, 17 Dec 2025 11:40:01 +0800 Subject: [PATCH 2/2] Fix API Login dan filter 0 di input nomor ### No Issue --- src/app/api/auth/login/route.ts | 18 ++++++++----- src/app/api/auth/resend/route.ts | 23 +++++++++------- src/app_modules/auth/login/view.tsx | 41 ++++++++++++++++++++++++----- 3 files changed, 60 insertions(+), 22 deletions(-) diff --git a/src/app/api/auth/login/route.ts b/src/app/api/auth/login/route.ts index a2abe2bd..ae5526f6 100644 --- a/src/app/api/auth/login/route.ts +++ b/src/app/api/auth/login/route.ts @@ -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 } ); - } + } } diff --git a/src/app/api/auth/resend/route.ts b/src/app/api/auth/resend/route.ts index 104e95c3..a6378462 100644 --- a/src/app/api/auth/resend/route.ts +++ b/src/app/api/auth/resend/route.ts @@ -18,22 +18,25 @@ export async function POST(req: Request) { const msg = `HIPMI%20-%20Kode%20ini%20bersifat%20RAHASIA%20dan%20JANGAN%20DI%20BAGIKAN%20KEPADA%20SIAPAPUN%2C%20termasuk%20anggota%20ataupun%20pengurus%20HIPMI%20lainnya.%5Cn%5Cn%3E%3E%20Kode%20OTP%20anda%3A%20${codeOtp}.`; - const res = await fetch( - `https://wa.wibudev.com/code?nom=${nomor}&text=${msg}`, - { cache: "no-cache" } + const res = await fetch( + `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", - }, + { success: false, message: "Nomor Whatsapp Tidak Aktif" }, { status: 400 } ); + const sendWa = await res.text(); + console.log("WA Response:", sendWa); + const createOtpId = await prisma.kodeOtp.create({ data: { nomor: nomor, diff --git a/src/app_modules/auth/login/view.tsx b/src/app_modules/auth/login/view.tsx index d6d890f9..b6615b05 100644 --- a/src/app_modules/auth/login/view.tsx +++ b/src/app_modules/auth/login/view.tsx @@ -21,17 +21,24 @@ import { apiFetchLogin } from "../_lib/api_fetch_auth"; export default function Login({ version }: { version: string }) { const router = useRouter(); - const [phone, setPhone] = useState(""); const [loading, setLoading] = useState(false); const [isError, setError] = useState(false); + const [phone, setPhone] = useState(""); + const [countryCode, setCountryCode] = useState("62"); // default ke Indonesia + async function onLogin() { - const nomor = phone.substring(1); + console.log("phone >>", phone); + + const nomor = phone; if (nomor.length <= 4) return setError(true); + const fixPhone = `${countryCode}${nomor}`; + console.log("fixPhone >>", fixPhone); + try { setLoading(true); - const respone = await apiFetchLogin({ nomor: nomor }); + const respone = await apiFetchLogin({ nomor: fixPhone }); if (respone && respone.success) { localStorage.setItem("hipmi_auth_code_id", respone.kodeId); @@ -72,16 +79,38 @@ export default function Login({ version }: { version: string }) {
Nomor telepon
+ { - setPhone(val); + inputStyle={{ width: "100%", backgroundColor: MainColor.login }} + onChange={(fullPhone, meta) => { + const dialCode = meta.country.dialCode; // string, misal: "62" + let localNumber = fullPhone; + + // Hapus kode negara dari awal string + if (fullPhone.startsWith(`+${dialCode}`)) { + localNumber = fullPhone.slice(`+${dialCode}`.length); + } + + // Bersihkan semua non-digit + localNumber = localNumber.replace(/\D/g, ""); + + // ✅ Filter khusus: untuk Indonesia (+62), hapus leading zero + if (dialCode === "62" && localNumber.startsWith("0")) { + localNumber = localNumber.replace(/^0+/, ""); // hapus semua 0 di awal + } + + // Simpan hasil akhir + setCountryCode(dialCode); + setPhone(localNumber); + + // console.log("Country Code:", dialCode); + // console.log("Clean Local Number:", localNumber); }} />