quivr/frontend/lib/api/brain/useBrainApi.ts
Mamadou DICKO 677e6bcefe
Shareable brain 4 (#611)
* feat(useBrainApi): add subscription creation to sdk

* feat: add share brain submit handler
2023-07-12 15:45:45 +02:00

32 lines
969 B
TypeScript

import { useAxios } from "@/lib/hooks";
import {
addBrainSubscriptions,
createBrain,
deleteBrain,
getBrain,
getBrainDocuments,
getBrains,
getDefaultBrain,
Subscription,
} 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),
addBrainSubscriptions: async (
brainId: string,
subscriptions: Subscription
) => addBrainSubscriptions(brainId, subscriptions, axiosInstance),
};
};