Navigate user if review status is completed

This commit is contained in:
Adw8 2024-07-30 17:34:24 +05:30
parent 9dfc15a840
commit ae49e6ff11

View File

@ -55,7 +55,7 @@ const UserVerification = () => {
}, [applicationSubmitted, kycId, navigate, cosmosAddress, message, receivedEthSig]);
const messageHandler: MessageHandler = (event, payload) => {
console.log('sumsubEvent:', event);
console.log('sumsubEvent:', event, payload);
if (event === 'idCheck.onApplicantLoaded') {
setKycId((payload as EventPayload<'idCheck.onApplicantLoaded'>).applicantId);
@ -66,9 +66,12 @@ const UserVerification = () => {
}
if (event === 'idCheck.onApplicantStatusChanged') {
if ((payload as EventPayload<'idCheck.onApplicantStatusChanged'>).reviewStatus === 'pending') {
const applicantStatus = (payload as EventPayload<'idCheck.onApplicantStatusChanged'>).reviewStatus;
if (applicantStatus === 'pending' || applicantStatus === 'completed') {
setApplicationSubmitted(true);
}
if ((payload as any).reviewResult.reviewAnswer === 'GREEN') {
setApplicationSubmitted(true);
}