quivr/frontend/lib/context/SupabaseProvider/hooks/useSupabase.ts

15 lines
376 B
TypeScript
Raw Normal View History

import { useContext } from "react";
import { SupabaseContext } from "../supabase-provider";
import { SupabaseContextType } from "../types";
export const useSupabase = (): SupabaseContextType => {
const context = useContext(SupabaseContext);
if (context === undefined) {
throw new Error("useSupabase must be used inside SupabaseProvider");
}
return context;
};