From 51e0c6dad68098273fa04add4e0d722197481ff4 Mon Sep 17 00:00:00 2001 From: "tomosa.sarkar" Date: Mon, 15 Dec 2025 12:27:52 +0530 Subject: [PATCH] fix: e mandate --- src/app/eMandate/otp_page/page.tsx | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/app/eMandate/otp_page/page.tsx b/src/app/eMandate/otp_page/page.tsx index ac8e513..46b9ef1 100644 --- a/src/app/eMandate/otp_page/page.tsx +++ b/src/app/eMandate/otp_page/page.tsx @@ -201,15 +201,14 @@ export default function VerifyOtpPage() { // } // setIsVerifying(false); // }; + const handleVerifyOtp = async () => { const mobile = localStorage.getItem("userMobNo"); if (!mobile || otp.length !== 6) return; setIsVerifying(true); - const success = await verifyOtp(otp, mobile); - if (success) { const encoded_data = localStorage.getItem("Validate_data"); @@ -218,24 +217,27 @@ export default function VerifyOtpPage() { setIsVerifying(false); return; } - - // Redirect to API URL with encoded data as query param - const redirectUrl = - "https://apiemandate.kccb.in:9035/EMandate/auth-cbs-resp?data=" + - encodeURIComponent(encoded_data); - - window.location.href = redirectUrl; // <-- FULL PAGE REDIRECT - - return; // ensure no more code runs + // Create a form for POST redirect + const form = document.createElement("form"); + form.method = "POST"; + form.action = "https://apiemandate.kccb.in:9035/EMandate/auth-cbs-resp"; + // Add hidden field "data" + const input = document.createElement("input"); + input.type = "hidden"; + input.name = "data"; + input.value = encoded_data; + form.appendChild(input); + document.body.appendChild(form); + // Submit → browser navigates to URL using POST + form.submit(); + return; // stop further execution } else { setOtp(""); } - setIsVerifying(false); }; - if (authorized === null) { return (