* 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>
17 lines
502 B
TypeScript
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')
|
|
}
|
|
})
|