@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
18 lines • 779 B
JavaScript
import { useCallback } from "react";
import useAxiosPrivate from "../../../config/useAxiosPrivate";
import useProject from "../../projects/useProject";
function useFetchConversation() {
const { projectId } = useProject();
const axios = useAxiosPrivate();
const fetchConversation = useCallback(async ({ conversationId }) => {
if (!projectId)
throw new Error("No projectId available.");
if (!conversationId)
throw new Error("Please pass a conversationId.");
const response = await axios.get(`/${projectId}/chat/conversations/${conversationId}`);
return response.data;
}, [projectId, axios]);
return fetchConversation;
}
export default useFetchConversation;
//# sourceMappingURL=useFetchConversation.js.map