quivr/frontend/lib/api/chat/useChatApi.ts

23 lines
619 B
TypeScript
Raw Normal View History

import { useAxios } from "@/lib/hooks";
import {
addQuestion,
AddQuestionParams,
createChat,
deleteChat,
getChats,
} from "./chat";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const useChatApi = () => {
const { axiosInstance } = useAxios();
return {
createChat: async (chatName: string) => createChat(chatName, axiosInstance),
getChats: async () => getChats(axiosInstance),
deleteChat: async (chatId: string) => deleteChat(chatId, axiosInstance),
addQuestion: async (props: AddQuestionParams) =>
addQuestion(props, axiosInstance),
};
};