Part of [Sumsub KYC integration in onboarding app](https://www.notion.so/Sumsub-KYC-integration-in-onboarding-app-607b598c9c1d4d12adc71725e2ab5e7e) Reviewed-on: cerc-io/testnet-onboarding-app#6
48 lines
974 B
TypeScript
48 lines
974 B
TypeScript
import React, { useEffect } from "react";
|
|
import {useNavigate } from "react-router-dom";
|
|
|
|
import { Button, Box, Container } from "@mui/material";
|
|
|
|
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
|
|
|
const ConnectWallet = () => {
|
|
const { connect, session } = useWalletConnectContext();
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (session) {
|
|
navigate("/sign-with-nitro-key");
|
|
}
|
|
}, [session, navigate,]);
|
|
|
|
const handler = async () => {
|
|
await connect();
|
|
};
|
|
|
|
return (
|
|
<Container maxWidth="lg">
|
|
<Box
|
|
display="flex"
|
|
flexDirection="column"
|
|
alignItems="center"
|
|
height="50vh"
|
|
justifyContent="center"
|
|
padding={5}
|
|
>
|
|
<Button
|
|
variant="contained"
|
|
onClick={handler}
|
|
style={{ marginTop: "20px" }}
|
|
>
|
|
Connect Wallet
|
|
</Button>
|
|
</Box>
|
|
</Container>
|
|
);
|
|
};
|
|
|
|
export default ConnectWallet;
|