Files
supabase/blocks/vue/registry/default/clients/nuxtjs/server/middleware/is-authenticated.ts
Jakub Andrzejewski 99499164dc Docs/UI library vue nuxt clients (#38279)
* docs: add vue client to ui-library

* docs: add missing vue client to llms.txt

* docs: add nuxt client to ui-library

* docs: wrong env variable names

* docs: fix dependencies

* docs: update client-nuxtjs.json

* Reinstall the deps so that the pnpm-lock.yaml has less changes.

* Add blocks/vue package.

* Remove the vue blocks from ui-library.

* Copy the vue blocks into ui-library.

* Clean up unneeded files.

* Regenerate the pnpm-lock file from master.

* Fix prettier errors.

* docs: update shadcn-vue cli

* docs: reusable server client

* Small things

* docs: improvments after CR

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Terry Sutton <saltcod@gmail.com>
2025-09-26 12:48:47 +00:00

17 lines
502 B
TypeScript

import { defineNuxtRouteMiddleware, navigateTo, useRequestEvent } from 'nuxt/app'
import { createSupabaseServerClient } from '../supabase/client'
export default defineNuxtRouteMiddleware(async (to) => {
const event = useRequestEvent()
// create Supabase SSR client directly here
const supabase = createSupabaseServerClient(event);
// check current user
const { data: { user } } = await supabase.auth.getUser()
if (!user && to.path !== '/login') {
return navigateTo('/login')
}
})