quivr/frontend/lib/api/chat/useChatApi.ts
Mamadou DICKO d51d4a1e90
Frontend/test/chat 3 (#517)
* refactor: add addQuestion to chat api

* test(chat): add unit tests to addQuestion
2023-07-05 13:39:07 +02:00

23 lines
619 B
TypeScript

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),
};
};