Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update component name #203

Merged
merged 1 commit into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
```js
export default defineNuxtConfig({
modules: ['@nuxtjs/turnstile'],

turnstile: {
siteKey: '<your-site-key>',
},

runtimeConfig: {
turnstile: {
// This can be overridden at runtime via the NUXT_TURNSTILE_SECRET_KEY
Expand All @@ -56,7 +56,7 @@

To use Turnstile, you will likely want to:

- Use the `<Turnstile>` component in your app (for example to build a contact form)
- Use the `<NuxtTurnstile>` component in your app (for example to build a contact form)
- Verify the token on your server, when you are processing an API request or a form submission (for example, before sending the email out)

### Client
Expand All @@ -67,14 +67,14 @@ To use Turnstile, add the auto-imported Vue component in whatever component need
<template>
<div>
<form @submit.prevent="onSubmit">
<Turnstile v-model="token" />
<NuxtTurnstile v-model="token" />
<input type="submit" />
</form>
</div>
</template>
```

`<Turnstile>` can take a number of options via the `options` argument. [See all options](./src/runtime/types.ts). It renders the Turnstile `<iframe>` within a `<div>` wrapper by default, but you can configure this by setting the `element` prop.
`<NuxtTurnstile>` can take a number of options via the `options` argument. [See all options](./src/runtime/types.ts). It renders the Turnstile `<iframe>` within a `<div>` wrapper by default, but you can configure this by setting the `element` prop.

When in the page, it will automatically load the Turnstile script and validate your user. Each validation lasts for 300s, and `@nuxtjs/turnstile` will automatically revalidate this token after 250s.

Expand All @@ -86,7 +86,7 @@ The turnstile token is no longer valid after being processed with CloudFlare via

```html
<template>
<Turnstile ref="turnstile" />
<NuxtTurnstile ref="turnstile" />
<button @click="turnstile.reset()">Reset token in template</button>
<button @click="reset()">Reset token from handler</button>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default defineNuxtModule<ModuleOptions>({
// Add plugin to load turnstile script
addPlugin({ src: join(runtimeDir, 'plugins/script') })

// Add <Turnstile> component
// Add <NuxtTurnstile> component
addComponentsDir({ path: join(runtimeDir, 'components') })

if (options.addValidateEndpoint) {
Expand Down