This commit is contained in:
2026-02-06 02:41:41 +03:00
parent ba2ff52394
commit f9d26a41d1
3 changed files with 17 additions and 8 deletions

View File

@ -1,12 +1,16 @@
import { createServerClient, type CookieOptions } from '@supabase/ssr';
import { cookies } from 'next/headers';
// Placeholders only for build when env is missing; production must set env before build
const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL || 'https://placeholder.supabase.co';
const SUPABASE_ANON_KEY = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || 'placeholder-anon-key';
export async function createServerSupabaseClient() {
const cookieStore = await cookies();
return createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
SUPABASE_URL,
SUPABASE_ANON_KEY,
{
cookies: {
get(name: string) {

View File

@ -1,10 +1,11 @@
import { createBrowserClient } from '@supabase/ssr';
// Placeholders only for build when env is missing; production must set env before build
const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL || 'https://placeholder.supabase.co';
const SUPABASE_ANON_KEY = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || 'placeholder-anon-key';
export function createClient() {
return createBrowserClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
);
return createBrowserClient(SUPABASE_URL, SUPABASE_ANON_KEY);
}
// Singleton instance for client-side usage