fix: e mandate

This commit is contained in:
2025-12-15 12:27:52 +05:30
parent 5a6d324ec9
commit 51e0c6dad6

View File

@@ -201,15 +201,14 @@ export default function VerifyOtpPage() {
// } // }
// setIsVerifying(false); // setIsVerifying(false);
// }; // };
const handleVerifyOtp = async () => { const handleVerifyOtp = async () => {
const mobile = localStorage.getItem("userMobNo"); const mobile = localStorage.getItem("userMobNo");
if (!mobile || otp.length !== 6) return; if (!mobile || otp.length !== 6) return;
setIsVerifying(true); setIsVerifying(true);
const success = await verifyOtp(otp, mobile); const success = await verifyOtp(otp, mobile);
if (success) { if (success) {
const encoded_data = localStorage.getItem("Validate_data"); const encoded_data = localStorage.getItem("Validate_data");
@@ -218,24 +217,27 @@ export default function VerifyOtpPage() {
setIsVerifying(false); setIsVerifying(false);
return; return;
} }
// Create a form for POST redirect
// Redirect to API URL with encoded data as query param const form = document.createElement("form");
const redirectUrl = form.method = "POST";
"https://apiemandate.kccb.in:9035/EMandate/auth-cbs-resp?data=" + form.action = "https://apiemandate.kccb.in:9035/EMandate/auth-cbs-resp";
encodeURIComponent(encoded_data); // Add hidden field "data"
const input = document.createElement("input");
window.location.href = redirectUrl; // <-- FULL PAGE REDIRECT input.type = "hidden";
input.name = "data";
return; // ensure no more code runs 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 { } else {
setOtp(""); setOtp("");
} }
setIsVerifying(false); setIsVerifying(false);
}; };
if (authorized === null) { if (authorized === null) {
return ( return (
<Center style={{ height: "100vh" }}> <Center style={{ height: "100vh" }}>