Persist subscriber ID in local storage #26
@ -33,13 +33,14 @@ const SignWithNitroKey = () => {
|
|||||||
const [cosmosAddress, setCosmosAddress] = useState("");
|
const [cosmosAddress, setCosmosAddress] = useState("");
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const subscriberIdHash = localStorage.getItem(SUBSCRIBER_ID_HASH_KEY);
|
const subscriberIdHash = localStorage.getItem(SUBSCRIBER_ID_HASH_KEY);
|
||||||
|
|
||||||
if(!subscriberIdHash){
|
useEffect(() => {
|
||||||
setIsLoading(false);
|
if (!subscriberIdHash) {
|
||||||
enqueueSnackbar("Subscriber ID not found. Please verify your email and try again", { variant: "error" });
|
setIsLoading(false);
|
||||||
}
|
enqueueSnackbar("Subscriber ID not found. Please verify your email and try again", { variant: "error" });
|
||||||
|
}
|
||||||
|
}, [subscriberIdHash]);
|
||||||
|
|
||||||
const message = useMemo(() => {
|
const message = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
@ -148,7 +149,7 @@ const SignWithNitroKey = () => {
|
|||||||
<LoadingButton
|
<LoadingButton
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={signEth}
|
onClick={signEth}
|
||||||
disabled={!Boolean(ethAddress)}
|
disabled={!Boolean(ethAddress) || !subscriberIdHash}
|
||||||
sx={{ marginTop: 2 }}
|
sx={{ marginTop: 2 }}
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
>
|
>
|
||||||
|
@ -4,6 +4,7 @@ import { jwtDecode } from "jwt-decode";
|
|||||||
import { ethers } from 'ethers';
|
import { ethers } from 'ethers';
|
||||||
|
|
||||||
import { Box, colors, Typography } from '@mui/material';
|
import { Box, colors, Typography } from '@mui/material';
|
||||||
|
|
||||||
import { SUBSCRIBER_ID_HASH_KEY } from '../constants';
|
import { SUBSCRIBER_ID_HASH_KEY } from '../constants';
|
||||||
|
|
||||||
interface JwtPayload {
|
interface JwtPayload {
|
||||||
|
Loading…
Reference in New Issue
Block a user