Navigate to user-verification page after signing with nitro-key
This commit is contained in:
parent
b79f1d500f
commit
c8d6664a89
@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect } from "react";
|
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";
|
import { Button, Box, Container } from "@mui/material";
|
||||||
|
|
||||||
@ -10,21 +10,13 @@ const ConnectWallet = () => {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const location = useLocation();
|
|
||||||
const { kycId } = location.state as {
|
|
||||||
kycId: string
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
||||||
if (session) {
|
if (session) {
|
||||||
navigate("/sign-with-nitro-key", {
|
navigate("/sign-with-nitro-key");
|
||||||
state: {
|
|
||||||
kycId
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}, [session, navigate, kycId]);
|
}, [session, navigate,]);
|
||||||
|
|
||||||
const handler = async () => {
|
const handler = async () => {
|
||||||
await connect();
|
await connect();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useMemo, useEffect } from "react";
|
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 { SnackbarProvider, enqueueSnackbar } from "notistack";
|
||||||
import canonicalStringify from "canonical-json";
|
import canonicalStringify from "canonical-json";
|
||||||
|
|
||||||
@ -15,10 +15,6 @@ import { utf8ToHex } from "@walletconnect/encoding";
|
|||||||
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
||||||
|
|
||||||
const SignWithNitroKey = () => {
|
const SignWithNitroKey = () => {
|
||||||
const location = useLocation();
|
|
||||||
const { kycId } = location.state as {
|
|
||||||
kycId: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const { session, signClient, checkPersistedState } =
|
const { session, signClient, checkPersistedState } =
|
||||||
useWalletConnectContext();
|
useWalletConnectContext();
|
||||||
@ -60,12 +56,11 @@ const SignWithNitroKey = () => {
|
|||||||
});
|
});
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
setEthSignature(ethSignature);
|
setEthSignature(ethSignature);
|
||||||
navigate("/sign-with-cosmos", {
|
navigate("/user-verification", {
|
||||||
state: {
|
state: {
|
||||||
message,
|
message,
|
||||||
cosmosAddress,
|
cosmosAddress,
|
||||||
receivedEthSig,
|
receivedEthSig,
|
||||||
kycId
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -9,7 +9,7 @@ const TermsAndConditions = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const handleAccept = () => {
|
const handleAccept = () => {
|
||||||
navigate('/user-verification');
|
navigate('/connect-wallet');
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
import { Box, Typography } from '@mui/material';
|
import { Box, Button, Typography } from '@mui/material';
|
||||||
import SumsubWebSdk from '@sumsub/websdk-react';
|
import SumsubWebSdk from '@sumsub/websdk-react';
|
||||||
|
|
||||||
import { fetchToken } from '../utils/getToken';
|
import { fetchToken } from '../utils/getToken';
|
||||||
@ -21,8 +21,11 @@ const UserVerification = () => {
|
|||||||
const [token, setToken] = useState<string>('');
|
const [token, setToken] = useState<string>('');
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const {message, cosmosAddress, receivedEthSig} = location.state;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getToken = async (kycId: string) => {
|
const getToken = async (kycId: string) => {
|
||||||
console.log(kycId);
|
console.log(kycId);
|
||||||
@ -88,6 +91,15 @@ const UserVerification = () => {
|
|||||||
<Typography variant="h5">User verification</Typography>
|
<Typography variant="h5">User verification</Typography>
|
||||||
<div id="sumsub-websdk-container"></div>
|
<div id="sumsub-websdk-container"></div>
|
||||||
</Box>
|
</Box>
|
||||||
|
<Button onClick={()=>{
|
||||||
|
navigate("/sign-with-cosmos", {
|
||||||
|
state: {
|
||||||
|
message,
|
||||||
|
cosmosAddress,
|
||||||
|
receivedEthSig,
|
||||||
|
kycId: 'unknown-kyc-id',
|
||||||
|
}})
|
||||||
|
}}>Sign with cosmos key</Button>
|
||||||
{!loading && token && (
|
{!loading && token && (
|
||||||
<SumsubWebSdk
|
<SumsubWebSdk
|
||||||
accessToken={token}
|
accessToken={token}
|
||||||
|
Loading…
Reference in New Issue
Block a user