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);
// };
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 (
<Center style={{ height: "100vh" }}>