Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1x 1x 23x 23x 7x 3x 1x 1x 7x 4x 3x | import { useAltchaStore } from "../stores/altcha.store";
import 'altcha'
const ALTCHA_CHALLENGE_URL = import.meta.env.VITE_ALTCHA_CHALLENGE_URL ?? '';
const VITE_ALTCHA_TOKEN_EXPIRY_SECONDS = parseInt(import.meta.env.VITE_ALTCHA_TOKEN_EXPIRY_SECONDS);
export function AltchaModal() {
const setPayload = useAltchaStore(s => s.setPayload);
const pending = useAltchaStore(s => s.pending);
const handleStateChange = (ev: CustomEvent) => {
if (ev.detail.state === 'verified') {
const payload = ev.detail.payload;
setPayload(payload);
}
};
if (!pending) {
return null;
}
return <altcha-widget auto="onload" expire={VITE_ALTCHA_TOKEN_EXPIRY_SECONDS*1000} onstatechange={handleStateChange} challengeurl={ALTCHA_CHALLENGE_URL} credentials='same-origin'></altcha-widget>;
}
|