mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-19 04:12:03 +03:00
3ba2c92b50
* refactor(MultipleBrain): separate providing and data fetching * refactor(MultipleBrain): update useBrainApi * feat(MultipleBrains): remove unnecessary data fetchings * test(useBrainApi): update unit tests
26 lines
765 B
TypeScript
26 lines
765 B
TypeScript
import { useAxios } from "@/lib/hooks";
|
|
|
|
import {
|
|
createBrain,
|
|
deleteBrain,
|
|
getBrain,
|
|
getBrainDocuments,
|
|
getBrains,
|
|
getDefaultBrain,
|
|
} from "./brain";
|
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
export const useBrainApi = () => {
|
|
const { axiosInstance } = useAxios();
|
|
|
|
return {
|
|
getBrainDocuments: async (brainId: string) =>
|
|
getBrainDocuments(brainId, axiosInstance),
|
|
createBrain: async (name: string) => createBrain(name, axiosInstance),
|
|
deleteBrain: async (id: string) => deleteBrain(id, axiosInstance),
|
|
getDefaultBrain: async () => getDefaultBrain(axiosInstance),
|
|
getBrains: async () => getBrains(axiosInstance),
|
|
getBrain: async (id: string) => getBrain(id, axiosInstance),
|
|
};
|
|
};
|