2023-07-06 20:01:23 +03:00
|
|
|
import { useAxios } from "@/lib/hooks";
|
|
|
|
|
2023-07-07 13:56:08 +03:00
|
|
|
import {
|
2023-07-12 16:45:45 +03:00
|
|
|
addBrainSubscriptions,
|
2023-07-07 13:56:08 +03:00
|
|
|
createBrain,
|
|
|
|
deleteBrain,
|
|
|
|
getBrain,
|
|
|
|
getBrainDocuments,
|
|
|
|
getBrains,
|
|
|
|
getDefaultBrain,
|
2023-07-12 16:45:45 +03:00
|
|
|
Subscription,
|
2023-07-07 13:56:08 +03:00
|
|
|
} from "./brain";
|
2023-07-06 20:01:23 +03:00
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
|
|
export const useBrainApi = () => {
|
|
|
|
const { axiosInstance } = useAxios();
|
|
|
|
|
|
|
|
return {
|
|
|
|
getBrainDocuments: async (brainId: string) =>
|
|
|
|
getBrainDocuments(brainId, axiosInstance),
|
2023-07-07 13:56:08 +03:00
|
|
|
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),
|
2023-07-12 16:45:45 +03:00
|
|
|
addBrainSubscriptions: async (
|
|
|
|
brainId: string,
|
|
|
|
subscriptions: Subscription
|
|
|
|
) => addBrainSubscriptions(brainId, subscriptions, axiosInstance),
|
2023-07-06 20:01:23 +03:00
|
|
|
};
|
|
|
|
};
|