diff --git a/src/pages/OnboardingSuccess.tsx b/src/pages/OnboardingSuccess.tsx index 0e439eb..4249e83 100644 --- a/src/pages/OnboardingSuccess.tsx +++ b/src/pages/OnboardingSuccess.tsx @@ -7,7 +7,7 @@ import { Registry } from "@cerc-io/registry-sdk"; import SumsubWebSdk from "@sumsub/websdk-react"; import { MessageHandler } from "@sumsub/websdk"; -import { accessTokenExpirationHandler, config, fetchAccessToken, options } from "../utils/sumsub"; +import { config, fetchAccessToken, getAccessTokenExpirationHandler, options } from "../utils/sumsub"; interface Participant { cosmosAddress: string; @@ -31,12 +31,7 @@ const OnboardingSuccess = () => { const [loading, setLoading] = useState(true); const messageHandler: MessageHandler = (event, payload) => { - console.log('sumsubEvent:', event); - - if (payload) { - console.log("Event payload is: ", payload); - } - + console.log('sumsubEvent:', event, payload); }; useEffect(() => { @@ -69,12 +64,10 @@ const OnboardingSuccess = () => { }; if (cosmosAddress) { - console.log("Cosmos addy: ", cosmosAddress); getToken(cosmosAddress).catch(error => { console.error(error); alert("Failed to fetch token"); }); - } }, [cosmosAddress]); @@ -112,10 +105,10 @@ const OnboardingSuccess = () => { KYC Status - {!loading && token && ( + {!loading && token && cosmosAddress && ( { const [kycId, setKycId] = useState('unknown'); @@ -88,10 +88,10 @@ const UserVerification = () => { User verification
- {!loading && token && ( + {!loading && token && userId && ( { - alert("Please renew token"); - return "Token expired"; +export const getAccessTokenExpirationHandler = (userId: string) => { + return async () => { + const newToken = await fetchAccessToken(userId); + return newToken; + } };