Navigate to sign-with-nitro page on uploading documents

This commit is contained in:
Adw8 2024-07-25 16:12:29 +05:30
parent 97178b4bea
commit 89e3e2704a
2 changed files with 30 additions and 9 deletions

View File

@ -16,8 +16,12 @@ function App() {
<WalletConnectProvider>
<Routes>
<Route path="/" element={<ConnectWallet />} />
<Route
path="/user-verification"
element={<UserVerification />}
></Route>
<Route element={<SignPageLayout />}>
<Route path="/sign-with-nitro-key" element={<SignWithNitroKey />} />
<Route path="/sign-with-nitro-key/:userId" element={<SignWithNitroKey />} />
<Route
path="/sign-with-cosmos/:cosmosAddress/:ethSignature"
element={<SignWithCosmos />}
@ -26,10 +30,6 @@ function App() {
path="/onboarding-success/:cosmosAddress"
element={<OnboardingSuccess />}
></Route>
<Route
path="/user-verification"
element={<UserVerification />}
></Route>
</Route>
<Route path="*" element={<PageNotFound />} />
</Routes>

View File

@ -1,14 +1,18 @@
import React from 'react'
import React, { useState } from 'react'
import { useNavigate } from 'react-router-dom';
import { Box, Typography } from '@mui/material'
import SumsubWebSdk from '@sumsub/websdk-react'
const UserVerification = () => {
const [userId, setUserId] = useState<String>('');
const navigate = useNavigate();
const config = {
lang: "en", //language of WebSDK texts and comments (ISO 639-1 format)
// email: applicantEmail,
// phone: applicantPhone,
theme: "light",
}
@ -17,15 +21,31 @@ const UserVerification = () => {
adaptIframeHeight: true
}
// TODO: Implement
const accessTokenExpirationHandler = async () => {
alert("Please renew token");
return "Token expired";
}
const accessToken = {
"token": process.env.REACT_APP_SUMSUB_TOKEN,
"token": process.env.REACT_APP_SUMSUB_TOKEN!,
"userId": "deepstack1234"
}
const messageHandler = (event: any, payload: any ) => {
if (event === 'idCheck.onApplicantLoaded'){
setUserId(payload.applicantId)
}
if (event === 'idCheck.onApplicantSubmitted'){
console.log('Application is submitted');
navigate(`/sign-with-nitro-key/${userId}`);
}
console.log(event);
console.log("Payload is ", payload);
}
return (
<>
<Box
@ -46,6 +66,7 @@ const UserVerification = () => {
expirationHandler={accessTokenExpirationHandler}
config={config}
options={options}
onMessage={messageHandler}
/>
</>
)