mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
This PR bumps `shadcn` and regenerates all blocks with the latest CLI. The blocks have no meaningful change (only a json property reorder). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated internal development tooling used by the UI library and Vue blocks. * **Tests** * Improved type consistency in registry-related test utilities, supporting more reliable validation without changing user-facing behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
42 lines
3.2 KiB
JSON
42 lines
3.2 KiB
JSON
{
|
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
"name": "supabase-client-nuxtjs",
|
|
"title": "Supabase Client for Nuxt.js",
|
|
"description": "",
|
|
"dependencies": [
|
|
"@supabase/ssr@latest",
|
|
"@supabase/supabase-js@latest"
|
|
],
|
|
"registryDependencies": [],
|
|
"files": [
|
|
{
|
|
"path": "lib/supabase/client.ts",
|
|
"content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NUXT_PUBLIC_SUPABASE_URL!,\n process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n",
|
|
"type": "registry:lib"
|
|
},
|
|
{
|
|
"path": "registry/default/clients/nuxtjs/server/middleware/is-authenticated.ts",
|
|
"content": "import { defineNuxtRouteMiddleware, navigateTo, useRequestEvent } from 'nuxt/app'\n\nimport { createSupabaseServerClient } from '../supabase/client'\n\nexport default defineNuxtRouteMiddleware(async (to) => {\n const event = useRequestEvent()\n\n // create Supabase SSR client directly here\n const supabase = createSupabaseServerClient(event)\n\n // check current user\n const {\n data: { user },\n } = await supabase.auth.getUser()\n\n if (!user && to.path !== '/login') {\n return navigateTo('/login')\n }\n})\n",
|
|
"type": "registry:file",
|
|
"target": "server/middleware/is-authenticated.ts"
|
|
},
|
|
{
|
|
"path": "registry/default/clients/nuxtjs/server/api/profile.get.ts",
|
|
"content": "import { createError, defineEventHandler } from 'h3'\n\nimport { createSupabaseServerClient } from '../supabase/client'\n\nexport default defineEventHandler(async (event) => {\n // Create Supabase SSR client\n const supabase = createSupabaseServerClient(event)\n\n // Example: get user session\n const {\n data: { user },\n } = await supabase.auth.getUser()\n\n if (!user) {\n return { error: 'Not authenticated' }\n }\n\n // Fetch profile row\n const { data, error } = await supabase.from('profiles').select('*').eq('id', user.id).single()\n\n if (error) {\n throw createError({ statusCode: 500, statusMessage: error.message })\n }\n\n return { profile: data }\n})\n",
|
|
"type": "registry:file",
|
|
"target": "server/api/profile.get.ts"
|
|
},
|
|
{
|
|
"path": "registry/default/clients/nuxtjs/server/supabase/client.ts",
|
|
"content": "import { createServerClient } from '@supabase/ssr'\nimport { deleteCookie, EventHandlerRequest, getCookie, H3Event, setCookie } from 'h3'\n\nexport const createSupabaseServerClient = (event: H3Event<EventHandlerRequest> | undefined) => {\n return createServerClient(\n process.env.NUXT_PUBLIC_SUPABASE_URL!,\n process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n get: (key) => getCookie(event!, key),\n set: (key, value, options) => setCookie(event!, key, value, options),\n remove: (key, options) => deleteCookie(event!, key, options),\n },\n }\n )\n}\n",
|
|
"type": "registry:file",
|
|
"target": "server/supabase/client.ts"
|
|
}
|
|
],
|
|
"envVars": {
|
|
"NUXT_PUBLIC_SUPABASE_URL": "",
|
|
"NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": ""
|
|
},
|
|
"docs": "You'll need to set the following environment variables in your project: `NUXT_PUBLIC_SUPABASE_URL` and `NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.",
|
|
"type": "registry:lib"
|
|
} |