diff --git a/src/civic_sign_frontend_demo/src/App.tsx b/src/civic_sign_frontend_demo/src/App.tsx index f59df11..fcb2b7b 100644 --- a/src/civic_sign_frontend_demo/src/App.tsx +++ b/src/civic_sign_frontend_demo/src/App.tsx @@ -9,6 +9,7 @@ function App() { const [principal, setPrincipal] = useState(undefined); const [urlCode, setUrlCode] = useState(null); const [selectedGatekeeperNetwork, setSelectedGatekeeperNetwork] = useState(config.gatekeeperNetworks[0]); + const [credentialCheckResponse, setCredentialCheckResponse] = useState(undefined); // Assume we have an array of available gatekeeperNetworks const gatekeeperNetworks = useMemo(() => config.gatekeeperNetworks, []); @@ -38,24 +39,40 @@ function App() { }, []); const handleCredentialCheck = useCallback(async (credential?: CredentialCheckResponse, error?: Error) => { - console.log('handleCredentialCheck', credential, error); + if (error) { + console.error('Error checking credential:', error); + return; + } + console.log('Credential check response:', credential); + setCredentialCheckResponse(credential); }, []); const handleGatekeeperNetworkChange = useCallback((event: React.ChangeEvent) => { const selectedNetwork = gatekeeperNetworks.find((network) => network.name === event.target.value); console.log('Selected network:', selectedNetwork); setSelectedGatekeeperNetwork(selectedNetwork || gatekeeperNetworks[0]); + setCredentialCheckResponse(undefined); }, []); return (
-
+
DFINITY logo {principal ? (

Welcome to the ICP Relying Canister

Logged in as {principal?.toText()}

+ {credentialCheckResponse && ( +
+

Response:

+
+
+                    {JSON.stringify(credentialCheckResponse.credential, null, 2)}
+                  
+
+
+ )} )}
+
); }