From 74297959d7393b2250f2dff4bb07d7650037ac59 Mon Sep 17 00:00:00 2001 From: "tomosa.sarkar" Date: Mon, 8 Dec 2025 12:33:08 +0530 Subject: [PATCH] feat : after successful OTP I send the return request. --- src/app/eMandate/otp_page/page.tsx | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/app/eMandate/otp_page/page.tsx b/src/app/eMandate/otp_page/page.tsx index 5fab32f..d2adf05 100644 --- a/src/app/eMandate/otp_page/page.tsx +++ b/src/app/eMandate/otp_page/page.tsx @@ -126,8 +126,29 @@ export default function VerifyOtpPage() { const success = await verifyOtp(otp, mobile); if (success) { - setTimeout(() => router.push("/eMandate/mandate_page"), 1500); - } else { + const encoded_data = localStorage.getItem("Validate_data"); + const res = await fetch( + `https://apiemandate.kccb.in:9035/Emandate/auth-cbs-resp?data=${encoded_data}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + } + ); + const result = await res.json(); + console.log(result); + if (!res.ok) { + throw new Error("CBS response API failed"); + } + if (res.ok) { + // navigate only after successful API hit + setTimeout(() => { + router.push("/eMandate/mandate_page"); + }, 1500); + } + } + else { setOtp(""); }