diff --git a/src/pages/ConnectWallet.tsx b/src/pages/ConnectWallet.tsx index 2fe6c20..776621f 100644 --- a/src/pages/ConnectWallet.tsx +++ b/src/pages/ConnectWallet.tsx @@ -1,5 +1,5 @@ import React, { useEffect } from "react"; -import { useLocation, useNavigate } from "react-router-dom"; +import {useNavigate } from "react-router-dom"; import { Button, Box, Container } from "@mui/material"; @@ -10,21 +10,13 @@ const ConnectWallet = () => { const navigate = useNavigate(); - const location = useLocation(); - const { kycId } = location.state as { - kycId: string - } useEffect(() => { if (session) { - navigate("/sign-with-nitro-key", { - state: { - kycId - }, - }); + navigate("/sign-with-nitro-key"); } - }, [session, navigate, kycId]); + }, [session, navigate,]); const handler = async () => { await connect(); diff --git a/src/pages/SignWithNitroKey.tsx b/src/pages/SignWithNitroKey.tsx index 402ac56..8785a37 100644 --- a/src/pages/SignWithNitroKey.tsx +++ b/src/pages/SignWithNitroKey.tsx @@ -1,5 +1,5 @@ import React, { useState, useMemo, useEffect } from "react"; -import { useLocation, useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import { SnackbarProvider, enqueueSnackbar } from "notistack"; import canonicalStringify from "canonical-json"; @@ -15,10 +15,6 @@ import { utf8ToHex } from "@walletconnect/encoding"; import { useWalletConnectContext } from "../context/WalletConnectContext"; const SignWithNitroKey = () => { - const location = useLocation(); - const { kycId } = location.state as { - kycId: string - } const { session, signClient, checkPersistedState } = useWalletConnectContext(); @@ -60,12 +56,11 @@ const SignWithNitroKey = () => { }); setIsLoading(false) setEthSignature(ethSignature); - navigate("/sign-with-cosmos", { + navigate("/user-verification", { state: { message, cosmosAddress, receivedEthSig, - kycId }, }); } catch (error) { diff --git a/src/pages/TermsAndConditions.tsx b/src/pages/TermsAndConditions.tsx index 87f34bc..9903513 100644 --- a/src/pages/TermsAndConditions.tsx +++ b/src/pages/TermsAndConditions.tsx @@ -9,7 +9,7 @@ const TermsAndConditions = () => { const navigate = useNavigate(); const handleAccept = () => { - navigate('/user-verification'); + navigate('/connect-wallet'); }; return ( diff --git a/src/pages/UserVerification.tsx b/src/pages/UserVerification.tsx index c0c93bf..59bebf7 100644 --- a/src/pages/UserVerification.tsx +++ b/src/pages/UserVerification.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; -import { Box, Typography } from '@mui/material'; +import { useLocation, useNavigate } from 'react-router-dom'; +import { Box, Button, Typography } from '@mui/material'; import SumsubWebSdk from '@sumsub/websdk-react'; import { fetchToken } from '../utils/getToken'; @@ -21,8 +21,11 @@ const UserVerification = () => { const [token, setToken] = useState(''); const [loading, setLoading] = useState(true); + const location = useLocation(); const navigate = useNavigate(); + const {message, cosmosAddress, receivedEthSig} = location.state; + useEffect(() => { const getToken = async (kycId: string) => { console.log(kycId); @@ -88,6 +91,15 @@ const UserVerification = () => { User verification
+ {!loading && token && (