wobsoriano / vue-clerk

Community Clerk Vue SDK.
https://vue-clerk.com
MIT License
144 stars 13 forks source link

feat(nuxt): Add route middleware for auth and guest pages #130

Closed wobsoriano closed 1 month ago

wobsoriano commented 1 month ago

Use the auth middleware to protect pages while doing client side routing.

<script setup>
definePageMeta({ middleware: 'auth', auth: { redirectUrl: '/sign-in' } })
</script>

<template>
  <h1>Authenticated only</h1>
</template>

For guest only pages, use the guest middleware.

<script setup>
definePageMeta({ middleware: 'guest', auth: { redirectUrl: '/profile' } })
</script>

<template>
  <h1>Guest only</h1>
</template>
vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vue-clerk ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 1, 2024 8:42pm
changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: b24710d4a6f9e8e282fc03a02c01d782b1e29abf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | --------- | ----- | | vue-clerk | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

pkg-pr-new[bot] commented 1 month ago

Open in Stackblitz

pnpm add https://pkg.pr.new/vue-clerk@130

commit: b24710d