mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 15:19:08 +03:00
* revert * Fix missing hcaptchastore import in _app --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
32 lines
625 B
TypeScript
32 lines
625 B
TypeScript
import HCaptcha from '@hcaptcha/react-hcaptcha'
|
|
import { proxy, useSnapshot } from 'valtio'
|
|
|
|
const hCaptchaLoadedStoreState = proxy({
|
|
loaded: false,
|
|
setLoaded() {
|
|
hCaptchaLoadedStoreState.loaded = true
|
|
},
|
|
})
|
|
|
|
export const useIsHCaptchaLoaded = () => {
|
|
const snap = useSnapshot(hCaptchaLoadedStoreState)
|
|
|
|
return snap.loaded
|
|
}
|
|
|
|
const HCaptchaLoadedStore = () => {
|
|
const onLoad = () => {
|
|
hCaptchaLoadedStoreState.setLoaded()
|
|
}
|
|
|
|
return (
|
|
<HCaptcha
|
|
sitekey={process.env.NEXT_PUBLIC_HCAPTCHA_SITE_KEY!}
|
|
size="invisible"
|
|
onLoad={onLoad}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default HCaptchaLoadedStore
|