UNPKG

@replyke/core

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

23 lines 1.09 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const react_1 = require("react"); const useAxiosPrivate_1 = __importDefault(require("../../../config/useAxiosPrivate")); const useProject_1 = __importDefault(require("../../projects/useProject")); function useFetchConversation() { const { projectId } = (0, useProject_1.default)(); const axios = (0, useAxiosPrivate_1.default)(); const fetchConversation = (0, react_1.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; } exports.default = useFetchConversation; //# sourceMappingURL=useFetchConversation.js.map