turnstile icon indicating copy to clipboard operation
turnstile copied to clipboard

I'm not sure how to use this

Open kickthemooon opened this issue 1 year ago • 2 comments

📚 Is your documentation request related to a problem?

I don't know how to use this.

🔍 Where should you find it?

I feel I you need a minimal working example usage right in the beginning.

ℹ️ Additional context

I have one request and a couple of questions.

First the request. Can you write a minimal working example usage of this in a nuxt form/component?

Assuming I have the flag addValidateEndpoint turned on, my questions are:

  1. In the usage you show the following:
<NuxtTurnstile v-model="token" />

My question is, do I need to generate this token or can I just remove this v-model? If I need to generate tokens, can you show an example of how?

  1. You also show this:
<template>
  <NuxtTurnstile ref="turnstile" />
  <button @click="turnstile.reset()">Reset token in template</button>
  <button @click="reset()">Reset token from handler</button>
</template>

<script setup>
  // you can call this template ref anything
  const turnstile = ref()

  function reset() {
    turnstile.value?.reset()
  }
</script>

I don't understand much here. Do I need to do this?

  1. What is the minimal code I need to write to get turnstile to work with addValidateEndpoint turned on?

Thanks.

kickthemooon avatar Dec 24 '24 14:12 kickthemooon

You can see an example here: https://github.com/nuxt-modules/turnstile/blob/main/playground/pages/index.vue

danielroe avatar Dec 25 '24 23:12 danielroe

I always look for the "example" directory. Will have to start looking for playground as well for nuxt projects at least. Thanks.

kickthemooon avatar Dec 29 '24 10:12 kickthemooon