From 1792d135d8ded1baf9d50caf570e465f5cd46731 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Fri, 9 Aug 2024 11:39:49 +0530 Subject: [PATCH] Disable nitro key sign button if subscribe ID does not exist --- src/pages/SignWithNitroKey.tsx | 13 +++++++------ src/pages/Thanks.tsx | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pages/SignWithNitroKey.tsx b/src/pages/SignWithNitroKey.tsx index 2b94a71..70eb635 100644 --- a/src/pages/SignWithNitroKey.tsx +++ b/src/pages/SignWithNitroKey.tsx @@ -33,13 +33,14 @@ const SignWithNitroKey = () => { const [cosmosAddress, setCosmosAddress] = useState(""); const [isLoading, setIsLoading] = useState(false); - const subscriberIdHash = localStorage.getItem(SUBSCRIBER_ID_HASH_KEY); - if(!subscriberIdHash){ - setIsLoading(false); - enqueueSnackbar("Subscriber ID not found. Please verify your email and try again", { variant: "error" }); - } + 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 = () => { diff --git a/src/pages/Thanks.tsx b/src/pages/Thanks.tsx index 794caf3..6cd4c3e 100644 --- a/src/pages/Thanks.tsx +++ b/src/pages/Thanks.tsx @@ -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 {