Skip to content

Commit 33bdf99

Browse files
fix(recaptcha): test
2 parents f0f52d8 + 96ad544 commit 33bdf99

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

components/Launcher.vue

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,44 @@
2020
</template>
2121

2222
<script setup>
23-
import { VueRecaptcha } from "vue-recaptcha"
24-
const websocket_store = use_websocket_store()
25-
const cloud_store = use_cloud_store()
26-
const { is_captcha_validated } = storeToRefs(cloud_store)
23+
import { VueRecaptcha } from "vue-recaptcha"
24+
const websocket_store = use_websocket_store()
25+
const cloud_store = use_cloud_store()
26+
const { is_captcha_validated } = storeToRefs(cloud_store)
2727
28-
watch(is_captcha_validated, async (value) => {
29-
if (value === true && process.client) {
30-
await cloud_store.create_connexion()
31-
await websocket_store.ws_connect()
32-
}
33-
})
28+
const site_key = useRuntimeConfig().public.RECAPTCHA_SITE_KEY
29+
30+
watch(is_captcha_validated, async (value) => {
31+
if (value === true && process.client) {
32+
await cloud_store.create_connexion()
33+
await websocket_store.ws_connect()
34+
}
35+
})
3436
35-
onMounted(() => {
36-
console.log("onMounted", useRuntimeConfig())
37-
})
37+
onMounted(() => {
38+
<<<<<<< HEAD
39+
console.log("onMounted", useRuntimeConfig())
40+
})
41+
=======
42+
if (process.client) {
43+
console.log("useRuntimeConfig()", useRuntimeConfig())
44+
const config = useRuntimeConfig()
45+
if (config.public.NODE_ENV !== "production") {
46+
cloud_store.$patch({ is_captcha_validated: true })
47+
}
48+
}
49+
})
50+
51+
async function submit_recaptcha(token) {
52+
try {
53+
const response = await $fetch.raw(
54+
`/.netlify/functions/recaptcha?token=${token}`,
55+
)
56+
cloud_store.$patch({ is_captcha_validated: response.status == 200 })
57+
recaptcha.reset()
58+
} catch (error) {
59+
console.error(error)
60+
}
61+
}
62+
>>>>>>> 96ad5440029efa83fba9a0825d38e5ca6625e9ae
3863
</script>

0 commit comments

Comments
 (0)