import { SupabaseClient } from "@supabase/supabase-js";
import type { Database } from "../types";
import { useContext } from "react";
import { Context } from "../context";
export const Context = createContext<SupabaseClient<Database> | undefined>(
undefined
);
export const useSupabaseClient = (): SupabaseClient<Database> => {
const client = useContext(Context);
if (client === undefined)
throw Error("No client has been specified using Provider.");
return client;
};
import { SupabaseClient } from "@supabase/supabase-js";
import type { Database } from "../types";
import { useContext } from "react";
import { Context } from "../context";
export const Context = createContext<SupabaseClient<Database> | undefined>(
undefined
);
export const useSupabaseClient = (): SupabaseClient<Database> => {
const client = useContext(Context);
if (client === undefined)
throw Error("No client has been specified using Provider.");
return client;
};