fix: E mandate validation
This commit is contained in:
@@ -21,7 +21,7 @@ function LoginEmandate() {
|
|||||||
const [isLogging, setIsLogging] = useState(false);
|
const [isLogging, setIsLogging] = useState(false);
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const data = searchParams.get("data");
|
const data = searchParams.get("data");
|
||||||
const mandateReqDoc= searchParams.get("mandateReqDoc");
|
const mandateReqDoc = searchParams.get("mandateReqDoc");
|
||||||
const mndtType = searchParams.get("mndtType");
|
const mndtType = searchParams.get("mndtType");
|
||||||
// const payload = searchParams.get("payload");
|
// const payload = searchParams.get("payload");
|
||||||
|
|
||||||
@@ -153,21 +153,35 @@ function LoginEmandate() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
console.log("Start to validate soft tech data");
|
||||||
const response = await fetch('/api/e-mandate/validation', {
|
const response = await fetch('/api/e-mandate/validation', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-Login-Type': 'eMandate',
|
'X-Login-Type': 'eMandate',
|
||||||
|
'Authorization': `Bearer ${localStorage.getItem("mandate_token")}`
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
data: localStorage.getItem("Emendate_data"),
|
data: localStorage.getItem("Emendate_data"),
|
||||||
mandateRequest:localStorage.getItem("Emendate_req_doc"),
|
mandateRequest: localStorage.getItem("Emendate_req_doc"),
|
||||||
mandateType: localStorage.getItem("Emendate_type"),
|
mandateType: localStorage.getItem("Emendate_type"),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
console.log("Validate Result : ",result);
|
console.log("Validate Result : ", result);
|
||||||
router.push("/eMandate/mandate_page");
|
if (response.ok) {
|
||||||
|
router.push("/eMandate/mandate_page");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log(result);
|
||||||
|
notifications.show({
|
||||||
|
withBorder: true,
|
||||||
|
color: "red",
|
||||||
|
title: "Validation failed",
|
||||||
|
message: "Failed to validate.Please try again later.",
|
||||||
|
autoClose: 5000,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user