@droppii-org/chat-sdk
Version:
Droppii React Chat SDK
25 lines (24 loc) • 966 B
JavaScript
import { useQuery } from "@tanstack/react-query";
import { QUERY_KEYS } from "../../services/query";
import { apiInstance } from "../../services/api";
import { ENDPOINTS } from "../../services/routes";
import { DChatApplicationType } from "../../types/chat";
export const useGetListSessionByConversation = ({ conversationId, page = 1, pageSize = 50, }) => useQuery({
queryKey: [
QUERY_KEYS.GET_LIST_SESSION_BY_CONVERSATION,
conversationId,
{ page, pageSize },
],
queryFn: async () => {
var _a;
const res = await apiInstance.get(ENDPOINTS.chatService.listSessionByConversation(conversationId), {
params: {
applicationType: DChatApplicationType.OBEFE,
page,
pageSize,
},
});
return (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data;
},
enabled: !!conversationId,
});