2023-07-05 14:33:26 +03:00
|
|
|
import { useAxios } from "@/lib/hooks";
|
|
|
|
|
2023-07-05 14:39:07 +03:00
|
|
|
import {
|
|
|
|
addQuestion,
|
|
|
|
AddQuestionParams,
|
|
|
|
createChat,
|
|
|
|
deleteChat,
|
|
|
|
getChats,
|
|
|
|
} from "./chat";
|
2023-07-05 14:33:26 +03:00
|
|
|
|
|
|
|
// 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),
|
2023-07-05 14:39:07 +03:00
|
|
|
addQuestion: async (props: AddQuestionParams) =>
|
|
|
|
addQuestion(props, axiosInstance),
|
2023-07-05 14:33:26 +03:00
|
|
|
};
|
|
|
|
};
|