Making progress on rewrite. Recreating queries and hooks now.
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import { createBrowserClient } from '@supabase/ssr';
|
||||
import type { Database } from '@/utils/supabase/database.types';
|
||||
import type { SupabaseClient } from '@/utils/supabase/types';
|
||||
import type { Database, SupabaseClient } from '@/utils/supabase';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
let client: SupabaseClient | undefined;
|
||||
|
||||
const getSupbaseClient = () => {
|
||||
const getSupbaseClient = (): SupabaseClient | undefined => {
|
||||
if (client) return client;
|
||||
client = createBrowserClient<Database>(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
|
@@ -2,10 +2,10 @@
|
||||
|
||||
import 'server-only';
|
||||
import { createServerClient } from '@supabase/ssr';
|
||||
import type { Database } from '@/utils/supabase/database.types';
|
||||
import type { Database, SupabaseClient } from '@/utils/supabase';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
export const useSupabaseServer = async () => {
|
||||
export const useSupabaseServer = async (): Promise<SupabaseClient | undefined> => {
|
||||
const cookieStore = await cookies();
|
||||
return createServerClient<Database>(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
|
Reference in New Issue
Block a user