Disable nitro key sign button if subscribe ID does not exist

This commit is contained in:
Shreerang Kale 2024-08-09 11:39:49 +05:30
parent e7581932f8
commit 1792d135d8
2 changed files with 8 additions and 6 deletions

View File

@ -33,13 +33,14 @@ const SignWithNitroKey = () => {
const [cosmosAddress, setCosmosAddress] = useState("");
const [isLoading, setIsLoading] = useState(false);
const subscriberIdHash = localStorage.getItem(SUBSCRIBER_ID_HASH_KEY);
useEffect(() => {
if (!subscriberIdHash) {
setIsLoading(false);
enqueueSnackbar("Subscriber ID not found. Please verify your email and try again", { variant: "error" });
}
}, [subscriberIdHash]);
const message = useMemo(() => {
return {
@ -148,7 +149,7 @@ const SignWithNitroKey = () => {
<LoadingButton
variant="contained"
onClick={signEth}
disabled={!Boolean(ethAddress)}
disabled={!Boolean(ethAddress) || !subscriberIdHash}
sx={{ marginTop: 2 }}
loading={isLoading}
>

View File

@ -4,6 +4,7 @@ import { jwtDecode } from "jwt-decode";
import { ethers } from 'ethers';
import { Box, colors, Typography } from '@mui/material';
import { SUBSCRIBER_ID_HASH_KEY } from '../constants';
interface JwtPayload {