feat: add design persistence functionality with Auth0 and Supabase integration
- Implemented `useDesignPersistence` composable for managing design records. - Enhanced `useSlipmatDesigner` to support loading designs from JSON. - Created global authentication middleware for route protection. - Added Supabase client plugin for database interactions. - Developed API endpoints for fetching, saving, and retrieving designs. - Introduced utility functions for Auth0 token verification and Supabase client retrieval. - Updated Nuxt configuration to include Auth0 and Supabase environment variables. - Added necessary dependencies for Auth0 and Supabase. - Enhanced TypeScript configuration for improved type support.
This commit is contained in:
27
plugins/supabase.client.ts
Normal file
27
plugins/supabase.client.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { createClient, type SupabaseClient } from "@supabase/supabase-js";
|
||||
import { defineNuxtPlugin, useRuntimeConfig } from "nuxt/app";
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
const { url, anonKey } = useRuntimeConfig().public.supabase;
|
||||
|
||||
if (!url || !anonKey) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
console.warn(
|
||||
"Supabase configuration is incomplete. Set SUPABASE_URL and SUPABASE_ANON_KEY in your environment."
|
||||
);
|
||||
}
|
||||
|
||||
nuxtApp.provide("supabase", null);
|
||||
return;
|
||||
}
|
||||
|
||||
const supabase = createClient(url, anonKey, {
|
||||
auth: {
|
||||
persistSession: true,
|
||||
storageKey: "slipmatz.supabase.auth",
|
||||
},
|
||||
});
|
||||
|
||||
nuxtApp.provide("supabase", supabase);
|
||||
nuxtApp.vueApp.config.globalProperties.$supabase = supabase;
|
||||
});
|
||||
Reference in New Issue
Block a user