Skip to content

Commit

Permalink
fix: opt in to import.meta.* properties (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Mar 25, 2024
1 parent fadf11f commit 82c4051
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/runtime/components/NuxtTurnstile.vue
Expand Up @@ -72,7 +72,7 @@ onMounted(async () => {
onBeforeUnmount(unmount)
// This means we will have CF script server-rendered in our HTML
if (process.server) {
if (import.meta.server) {
nuxtApp.$turnstile.loadTurnstile()
}
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/plugins/script.ts
Expand Up @@ -33,24 +33,24 @@ export default defineNuxtPlugin(nuxtApp => {
const turnstile = {
loadTurnstile: async () => {
addTurnstileScript.value = true
if (process.server) return
if (import.meta.server) return
;(await (window as any).loadTurnstile) as Promise<void>
},
async render(element, options) {
if (process.server) return
if (import.meta.server) return
await this.loadTurnstile()
return (window as any).turnstile.render(element, {
sitekey: config.public.turnstile.siteKey,
...options,
})
},
async reset(element) {
if (process.server) return
if (import.meta.server) return
await this.loadTurnstile()
return (window as any).turnstile.reset(element)
},
async remove(element) {
if (process.server) return
if (import.meta.server) return

if (addTurnstileScript.value) {
return (window as any).turnstile.remove(element)
Expand Down

0 comments on commit 82c4051

Please sign in to comment.