Add Vercel serverless functions for Supabase-backed onboarding endpoints
cgen-d4722a4bcdad4e3ea1909553b2020be9
This commit is contained in:
parent
6d23639e03
commit
11281c9e6a
1 changed files with 12 additions and 0 deletions
12
api/_supabase.ts
Normal file
12
api/_supabase.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { createClient } from "@supabase/supabase-js";
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL || process.env.VITE_SUPABASE_URL || "";
|
||||
const SUPABASE_SERVICE_ROLE = process.env.SUPABASE_SERVICE_ROLE || "";
|
||||
|
||||
export function getAdminClient() {
|
||||
if (!SUPABASE_URL) throw new Error("SUPABASE_URL not set");
|
||||
if (!SUPABASE_SERVICE_ROLE) throw new Error("SUPABASE_SERVICE_ROLE not set");
|
||||
return createClient(SUPABASE_URL, SUPABASE_SERVICE_ROLE, {
|
||||
auth: { autoRefreshToken: false, persistSession: false },
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue