Persist subscriber ID in local storage #26
@ -12,6 +12,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"indent": ["error", 2, { "SwitchCase": 1 }]
|
"indent": ["error", 2, { "SwitchCase": 1 }],
|
||||||
|
"semi": ["error", "always"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import { Link, useLocation } from 'react-router-dom';
|
|||||||
import { AppBar, Toolbar, Avatar, Box, IconButton } from '@mui/material';
|
import { AppBar, Toolbar, Avatar, Box, IconButton } from '@mui/material';
|
||||||
|
|
||||||
const Header: React.FC = () => {
|
const Header: React.FC = () => {
|
||||||
const location = useLocation()
|
const location = useLocation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppBar position="static" color="inherit">
|
<AppBar position="static" color="inherit">
|
||||||
|
@ -14,16 +14,16 @@ const SelectRoleCard = ({ handleAccept, handleRoleChange }: { handleAccept: () =
|
|||||||
const [checked, setChecked] = useState(false);
|
const [checked, setChecked] = useState(false);
|
||||||
const [isHidden, setIsHidden] = useState(false);
|
const [isHidden, setIsHidden] = useState(false);
|
||||||
|
|
||||||
const [isDialogOpen, setisDialogOpen] = useState(false)
|
const [isDialogOpen, setisDialogOpen] = useState(false);
|
||||||
|
|
||||||
const handleCheckboxChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleCheckboxChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setChecked(event.target.checked);
|
setChecked(event.target.checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleContinue = () => {
|
const handleContinue = () => {
|
||||||
handleAccept()
|
handleAccept();
|
||||||
setIsHidden(true)
|
setIsHidden(true);
|
||||||
}
|
};
|
||||||
|
|
||||||
const handleRadioChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleRadioChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setSelectedRole(event.target.value as Role);
|
setSelectedRole(event.target.value as Role);
|
||||||
|
@ -4,7 +4,7 @@ import { Document, Page, pdfjs } from 'react-pdf';
|
|||||||
import { Typography } from '@mui/material';
|
import { Typography } from '@mui/material';
|
||||||
|
|
||||||
// https://github.com/wojtekmaj/react-pdf?tab=readme-ov-file#copy-worker-to-public-directory
|
// https://github.com/wojtekmaj/react-pdf?tab=readme-ov-file#copy-worker-to-public-directory
|
||||||
pdfjs.GlobalWorkerOptions.workerSrc = process.env.PUBLIC_URL + '/pdf.worker.min.mjs'
|
pdfjs.GlobalWorkerOptions.workerSrc = process.env.PUBLIC_URL + '/pdf.worker.min.mjs';
|
||||||
|
|
||||||
const TermsAndConditionsBox = ({height}: {height: string}) => {
|
const TermsAndConditionsBox = ({height}: {height: string}) => {
|
||||||
const [numPages, setNumPages] = useState<number>();
|
const [numPages, setNumPages] = useState<number>();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react';
|
||||||
|
|
||||||
import { Box, Typography } from '@mui/material'
|
import { Box, Typography } from '@mui/material';
|
||||||
|
|
||||||
import { REDIRECT_EMAIL_MSG } from '../constants'
|
import { REDIRECT_EMAIL_MSG } from '../constants';
|
||||||
|
|
||||||
const Email = () => {
|
const Email = () => {
|
||||||
return (
|
return (
|
||||||
@ -27,7 +27,7 @@ const Email = () => {
|
|||||||
{REDIRECT_EMAIL_MSG}
|
{REDIRECT_EMAIL_MSG}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default Email
|
export default Email;
|
||||||
|
@ -25,7 +25,7 @@ const OnboardingSuccess = () => {
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { cosmosAddress } = location.state as {
|
const { cosmosAddress } = location.state as {
|
||||||
cosmosAddress?: string
|
cosmosAddress?: string
|
||||||
}
|
};
|
||||||
|
|
||||||
const [participant, setParticipant] = useState<Participant>();
|
const [participant, setParticipant] = useState<Participant>();
|
||||||
const [token, setToken] = useState<string>('');
|
const [token, setToken] = useState<string>('');
|
||||||
|
@ -37,7 +37,7 @@ const SignWithNitroKey = () => {
|
|||||||
const subscriberIdHash = localStorage.getItem(SUBSCRIBER_ID_HASH_KEY);
|
const subscriberIdHash = localStorage.getItem(SUBSCRIBER_ID_HASH_KEY);
|
||||||
|
|
||||||
if(!subscriberIdHash){
|
if(!subscriberIdHash){
|
||||||
setIsLoading(false)
|
setIsLoading(false);
|
||||||
enqueueSnackbar("Subscriber ID not found. Please verify your email and try again", { variant: "error" });
|
enqueueSnackbar("Subscriber ID not found. Please verify your email and try again", { variant: "error" });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ const SignWithNitroKey = () => {
|
|||||||
const signEth = async () => {
|
const signEth = async () => {
|
||||||
if (session && signClient) {
|
if (session && signClient) {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true)
|
setIsLoading(true);
|
||||||
const jsonMessage = canonicalStringify(message);
|
const jsonMessage = canonicalStringify(message);
|
||||||
const hexMsg = utf8ToHex(jsonMessage, true);
|
const hexMsg = utf8ToHex(jsonMessage, true);
|
||||||
const receivedEthSig: string = await signClient!.request({
|
const receivedEthSig: string = await signClient!.request({
|
||||||
@ -62,7 +62,7 @@ const SignWithNitroKey = () => {
|
|||||||
params: [hexMsg, ethAddress],
|
params: [hexMsg, ethAddress],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
setIsLoading(false)
|
setIsLoading(false);
|
||||||
setEthSignature(ethSignature);
|
setEthSignature(ethSignature);
|
||||||
|
|
||||||
if (ENABLE_KYC) {
|
if (ENABLE_KYC) {
|
||||||
@ -84,7 +84,7 @@ const SignWithNitroKey = () => {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("err in signing ", error);
|
console.log("err in signing ", error);
|
||||||
setIsLoading(false)
|
setIsLoading(false);
|
||||||
enqueueSnackbar("Error signing message", { variant: "error" });
|
enqueueSnackbar("Error signing message", { variant: "error" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,14 +25,14 @@ const Thanks: React.FC = () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if(!token){
|
if(!token){
|
||||||
throw new Error("Invalid JWT Token")
|
throw new Error("Invalid JWT Token");
|
||||||
}
|
}
|
||||||
|
|
||||||
const decoded = jwtDecode(token) as JwtPayload;
|
const decoded = jwtDecode(token) as JwtPayload;
|
||||||
const currentTime = Math.floor(Date.now() / 1000);
|
const currentTime = Math.floor(Date.now() / 1000);
|
||||||
|
|
||||||
if (!decoded.subscriber_id) {
|
if (!decoded.subscriber_id) {
|
||||||
throw new Error("Subscriber ID not found")
|
throw new Error("Subscriber ID not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decoded.exp < currentTime) {
|
if (decoded.exp < currentTime) {
|
||||||
|
@ -52,7 +52,7 @@ const UserVerification = () => {
|
|||||||
cosmosAddress,
|
cosmosAddress,
|
||||||
receivedEthSig,
|
receivedEthSig,
|
||||||
kycIdHash
|
kycIdHash
|
||||||
}})
|
}});
|
||||||
}
|
}
|
||||||
}, [applicationSubmitted, kycId, navigate, cosmosAddress, message, receivedEthSig]);
|
}, [applicationSubmitted, kycId, navigate, cosmosAddress, message, receivedEthSig]);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React from 'react'
|
import React from 'react';
|
||||||
|
|
||||||
const VerifyEmail = () => {
|
const VerifyEmail = () => {
|
||||||
return (
|
return (
|
||||||
@ -18,7 +18,7 @@ const VerifyEmail = () => {
|
|||||||
}}
|
}}
|
||||||
></iframe>
|
></iframe>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default VerifyEmail
|
export default VerifyEmail;
|
||||||
|
@ -29,5 +29,5 @@ export const getAccessTokenExpirationHandler = (userId: string) => {
|
|||||||
return async () => {
|
return async () => {
|
||||||
const newToken = await fetchAccessToken(userId);
|
const newToken = await fetchAccessToken(userId);
|
||||||
return newToken;
|
return newToken;
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user