From 8cd77ad1d82476a34689fd63b957721d884ca5bd Mon Sep 17 00:00:00 2001 From: Jai A Date: Mon, 18 Nov 2024 16:29:55 -0800 Subject: [PATCH] Fix captcha not showing on create account page --- apps/frontend/src/components/ui/HCaptcha.vue | 26 +++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/apps/frontend/src/components/ui/HCaptcha.vue b/apps/frontend/src/components/ui/HCaptcha.vue index 3421afa01..bacc2516a 100644 --- a/apps/frontend/src/components/ui/HCaptcha.vue +++ b/apps/frontend/src/components/ui/HCaptcha.vue @@ -12,17 +12,21 @@ function hCaptchaReady() { } onMounted(() => { - window.hCaptchaReady = hCaptchaReady; - - useHead({ - script: [ - { - src: "https://js.hcaptcha.com/1/api.js?render=explicit&onload=hCaptchaReady", - async: true, - defer: true, - }, - ], - }); + if (window.hcaptcha) { + hCaptchaReady(); + } else { + window.hCaptchaReady = hCaptchaReady; + + useHead({ + script: [ + { + src: "https://js.hcaptcha.com/1/api.js?render=explicit&onload=hCaptchaReady", + async: true, + defer: true, + }, + ], + }); + } }); defineExpose({