@droppii-org/chat-sdk
Version:
Droppii React Chat SDK
19 lines (18 loc) • 842 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 useAuthStore from "../../store/auth";
export const useGetUserSideInfo = (conversationId, userId) => useQuery({
queryKey: [QUERY_KEYS.GET_USER_SIDE_INFO, conversationId, userId],
queryFn: async () => {
var _a;
const res = await apiInstance.get(ENDPOINTS.chatService.getUserSideInfo(conversationId, userId), {
params: {
applicationType: useAuthStore.getState().applicationType,
},
});
return (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data;
},
enabled: Boolean(conversationId && userId),
});