mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-18 20:01:52 +03:00
9c8e0aa0e4
* 🗑️ remove date input from fetch_user_id_from_credentials * ♻️ refactor backend utils by splitting it into files * 💡 comments for next actions to update /upload * 🚚 move SupabaseProvider tp libs * 🚚 move useAxios to hooks * ♻️ refacto brain routes * 🚨 update lintermfor paths * ✨ new brain context provider * ✨ new brain component in navbar * 🚨 fix linter and async * 🇸🇪 add feature flag for multiple-brains
17 lines
458 B
TypeScript
17 lines
458 B
TypeScript
import { createContext, useContext } from "react";
|
|
|
|
import { BrainStateProps } from "./useBrainState";
|
|
import { ScopeContext } from "../types";
|
|
|
|
export const BrainContext = createContext<ScopeContext | undefined>(undefined);
|
|
|
|
export const useBrainContext = (): BrainStateProps => {
|
|
const context = useContext(BrainContext);
|
|
|
|
if (context === undefined) {
|
|
throw new Error("useBrainContext must be used inside BrainProvider");
|
|
}
|
|
|
|
return context;
|
|
};
|